Tried to set MUC room avatar with Beagle - by default it offers taking photo, which I used and in the end ran into Exception:
[2019-12-05 15:47:38:267] [SEVERE ] [ in_22-muc ] StanzaProcessor.processPacket() : tigase.component.exceptions.RepositoryException: Error while setting avatar for room friends@muc.atlantiscity when processing from=sess-man@localhost, to=null, DATA=<iq from="admin@atlantiscity/1204607085-tigase-1" to="friends@muc.atlantiscity" xmlns="jabber:client" type="set"><vCard xmlns="vcard-temp"><PHOTO><TYPE>CData size: 10</TYPE><BINVAL>CData size: 156332</BINVAL></PHOTO></vCard></iq>, SIZE=156539, XMLNS=jabber:client, PRIORITY=NORMAL, PERMISSION=ADMIN, TYPE=set
java.lang.RuntimeException: tigase.component.exceptions.RepositoryException: Error while setting avatar for room friends@muc.atlantiscity
at tigase.muc.modules.VCardModule.process(VCardModule.java:133)
at tigase.component.modules.StanzaProcessor.process(StanzaProcessor.java:164)
at tigase.component.modules.StanzaProcessor.processPacket(StanzaProcessor.java:85)
at tigase.component.AbstractKernelBasedComponent.processPacket(AbstractKernelBasedComponent.java:81)
at tigase.muc.MUCComponent.processPacket(MUCComponent.java:122)
at tigase.server.AbstractMessageReceiver$QueueListener.run(AbstractMessageReceiver.java:1401)
Caused by: tigase.component.exceptions.RepositoryException: Error while setting avatar for room friends@muc.atlantiscity
at tigase.muc.repository.JDBCMucDAO.updateRoomAvatar(JDBCMucDAO.java:280)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at tigase.stats.StatisticsInvocationHandler.invoke(StatisticsInvocationHandler.java:75)
at com.sun.proxy.$Proxy48.updateRoomAvatar(Unknown Source)
at tigase.muc.repository.MucDAOMDBean.updateRoomAvatar(MucDAOMDBean.java:106)
at tigase.muc.repository.inmemory.InMemoryMucRepository.updateRoomAvatar(InMemoryMucRepository.java:137)
at tigase.muc.modules.VCardModule.processSet(VCardModule.java:202)
at tigase.muc.modules.VCardModule.process(VCardModule.java:126)
... 5 more
Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column '_avatar' at row 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3976)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2495)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1903)
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1242)
at com.mysql.jdbc.CallableStatement.execute(CallableStatement.java:837)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at tigase.db.jdbc.PreparedStatementInvocationHandler.invoke(PreparedStatementInvocationHandler.java:38)
at com.sun.proxy.$Proxy35.execute(Unknown Source)
at tigase.muc.repository.JDBCMucDAO.updateRoomAvatar(JDBCMucDAO.java:277)
... 15 more
I think there are a couple of issues here:
tigase-muc should handle gracefully images that exceed (sensible) limit; (BeagleIM image wasn't all that big though: <BINVAL>CData size: 156332</BINVAL>)
currently we use text for avatar, which isn't all that big (https://dev.mysql.com/doc/refman/5.7/en/string-type-overview.html: TEXT = 65,535 (216−1) bytes = 64 KiB) - maybe we should switch to MEDIUMTEXT = 16,777,215 (224−1) bytes = 16 MiB (and impose said sensible limit on the application level (configurable)?
Andrzej Wójcik (Tigase) commented 5 years ago
I would suggest changing the field type to mediumtext.
wojciech.kapcia@tigase.net commented 5 years ago
Modified tigase-muc schema to handle bigger avatars and TTS-NG to test them.
wojciech.kapcia@tigase.net commented 5 years ago
Additional fix for derby (use CLOB everywhere) and using slightly smaller images in test-case (less than 1M) to avoid hitting CData limit in SimpleParser.
Tried to set MUC room avatar with Beagle - by default it offers taking photo, which I used and in the end ran into Exception:
I think there are a couple of issues here:
<BINVAL>CData size: 156332</BINVAL>
)text
for avatar, which isn't all that big (https://dev.mysql.com/doc/refman/5.7/en/string-type-overview.html: TEXT = 65,535 (216−1) bytes = 64 KiB) - maybe we should switch toMEDIUMTEXT = 16,777,215 (224−1) bytes = 16 MiB
(and impose said sensible limit on the application level (configurable)?