Projects tigase _server tigase-http-api Issues #125
RuntimeException: tigase.db.TigaseDBException: Could not allocate slot (Incorrect string value) (#125)
Closed
wojciech.kapcia@tigase.net opened 2 years ago
[2023-02-26 04:29:12:240] [SEVERE  ] [           in_0-upload ] StanzaProcessor.processPacket()  : tigase.db.TigaseDBException: Could not allocate slot when processing from=sess-man@ip-172-31-20-109.us-west-2.compute.internal, to=null, serverAuthorisedStanzaFrom=Optional.empty, DATA=<iq id="aa085504-3202-4958-844f-e2156501f115" type="get" to="upload.sure.im" xmlns="jabber:client" from="…@sure.im/dino.…"><request filename="…" xmlns="urn:xmpp:http:upload:0" content-type="omemo" size="7610228"/></iq>, SIZE=260, XMLNS=jabber:client, PRIORITY=NORMAL, PERMISSION=AUTH, TYPE=get, STABLE_ID=null
java.lang.RuntimeException: tigase.db.TigaseDBException: Could not allocate slot
	at tigase.http.upload.logic.DefaultLogic.requestSlot(DefaultLogic.java:124)
	at tigase.http.upload.SlotRequestModule.process(SlotRequestModule.java:86)
	at tigase.component.modules.StanzaProcessor.execute(StanzaProcessor.java:219)
	at tigase.component.modules.StanzaProcessor.process(StanzaProcessor.java:206)
	at tigase.component.modules.StanzaProcessor.processPacket(StanzaProcessor.java:103)
	at tigase.component.AbstractKernelBasedComponent.processPacket(AbstractKernelBasedComponent.java:81)
	at tigase.server.AbstractMessageReceiver$QueueListener.run(AbstractMessageReceiver.java:1398)
Caused by: tigase.db.TigaseDBException: Could not allocate slot
	at tigase.http.upload.db.JDBCFileUploadRepository.allocateSlot(JDBCFileUploadRepository.java:113)
	at tigase.http.upload.db.FileUploadRepository.allocateSlot(FileUploadRepository.java:50)
	at tigase.http.upload.db.FileUploadRepositoryPool.allocateSlot(FileUploadRepositoryPool.java:50)
	at tigase.http.upload.logic.DefaultLogic.requestSlot(DefaultLogic.java:121)
	... 6 more
Caused by: java.sql.SQLException: Incorrect string value: '\xF0\x9F\x86\x94 @...' for column '_filename1' at row 1
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
	at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
	at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1009)
	at com.mysql.cj.jdbc.CallableStatement.executeQuery(CallableStatement.java:891)
	at jdk.internal.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at tigase.db.jdbc.PreparedStatementInvocationHandler.invoke(PreparedStatementInvocationHandler.java:38)
	at jdk.proxy2/jdk.proxy2.$Proxy35.executeQuery(Unknown Source)
	at tigase.http.upload.db.JDBCFileUploadRepository.allocateSlot(JDBCFileUploadRepository.java:103)
	... 9 more

IMHO it should result in correct IQ error returned to the user.

wojciech.kapcia@tigase.net commented 2 years ago

Unobfuscated log:

[2023-02-26 04:29:12:240] [SEVERE  ] [           in_0-upload ] StanzaProcessor.processPacket()  : tigase.db.TigaseDBException: Could not allocate slot when processing from=sess-man@ip-172-31-20-109.us-west-2.compute.internal, to=null, serverAuthorisedStanzaFrom=Optional.empty, DATA=<iq id="aa085504-3202-4958-844f-e2156501f115" type="get" to="upload.sure.im" xmlns="jabber:client" from="…@sure.im/dino.…"><request filename="We Paid \uD83C\uDD94 @Aashaddis On TG.mp3" xmlns="urn:xmpp:http:upload:0" content-type="omemo" size="7610228"/></iq>, SIZE=260, XMLNS=jabber:client, PRIORITY=NORMAL, PERMISSION=AUTH, TYPE=get, STABLE_ID=null
java.lang.RuntimeException: tigase.db.TigaseDBException: Could not allocate slot
	at tigase.http.upload.logic.DefaultLogic.requestSlot(DefaultLogic.java:124)
	at tigase.http.upload.SlotRequestModule.process(SlotRequestModule.java:86)
	at tigase.component.modules.StanzaProcessor.execute(StanzaProcessor.java:219)
	at tigase.component.modules.StanzaProcessor.process(StanzaProcessor.java:206)
	at tigase.component.modules.StanzaProcessor.processPacket(StanzaProcessor.java:103)
	at tigase.component.AbstractKernelBasedComponent.processPacket(AbstractKernelBasedComponent.java:81)
	at tigase.server.AbstractMessageReceiver$QueueListener.run(AbstractMessageReceiver.java:1398)
Caused by: tigase.db.TigaseDBException: Could not allocate slot
	at tigase.http.upload.db.JDBCFileUploadRepository.allocateSlot(JDBCFileUploadRepository.java:113)
	at tigase.http.upload.db.FileUploadRepository.allocateSlot(FileUploadRepository.java:50)
	at tigase.http.upload.db.FileUploadRepositoryPool.allocateSlot(FileUploadRepositoryPool.java:50)
	at tigase.http.upload.logic.DefaultLogic.requestSlot(DefaultLogic.java:121)
	... 6 more
Caused by: java.sql.SQLException: Incorrect string value: '\xF0\x9F\x86\x94 @...' for column '_filename1' at row 1
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
	at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
	at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1009)
	at com.mysql.cj.jdbc.CallableStatement.executeQuery(CallableStatement.java:891)
	at jdk.internal.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at tigase.db.jdbc.PreparedStatementInvocationHandler.invoke(PreparedStatementInvocationHandler.java:38)
	at jdk.proxy2/jdk.proxy2.$Proxy35.executeQuery(Unknown Source)
	at tigase.http.upload.db.JDBCFileUploadRepository.allocateSlot(JDBCFileUploadRepository.java:103)
	... 9 more
Andrzej Wójcik (Tigase) commented 2 years ago

@wojtek Should we allow unicode in file names? as I think that this is causing that issue..

wojciech.kapcia@tigase.net commented 2 years ago

It looks like it, and more specifically, MySQL "broken" Unicode support. I'm not a fan of odd characters in filenames (usually avoid them) but on the other hand I think we should allow them and handle them (as long as underlying storage allows us to store/serve them).

Andrzej Wójcik (Tigase) commented 2 years ago

Fix was created and PR was created.

issue 1 of 1
Type
Bug
Priority
Normal
Assignee
Version
Candidate for next minor release
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/tigase-http-api#125
Please wait...
Page is in error, reload to recover