Hey all! I am getting this in prosody logs while trying to send PEP avatar via my component:
mod_component debug Received invalid XML (stanza-too-large) 4096 bytes: "[some-data]"
2022-09-29T10:34:47.892579714Z mod_component info Disconnecting component, <stream:error> is: not-well-formed
in here: https://xmpp.org/extensions/xep-0084.html#revision-history-v0.11 it seems there is no size requirements. I can just resize the avatar data but is this really required? I fail to find the relevant reference about this. any pointers?✎
nicoco
Hey all! I am getting this in prosody logs while trying to send PEP avatar via my component:
mod_component debug Received invalid XML (stanza-too-large) 4096 bytes: "[some-data]"
mod_component info Disconnecting component, <stream:error> is: not-well-formed
in here: https://xmpp.org/extensions/xep-0084.html#revision-history-v0.11 it seems there is no size requirements. I can just resize the avatar data but is this really required? I fail to find the relevant reference about this. any pointers? ✏
MattJ
Size limits in XMPP are (loosely) defined in the RFC: https://xmpp.org/rfcs/rfc6120.html#security-dos
MattJ
Ultimately they are a per-deployment decision, but the RFC gives you at least "10000" (for the whole stanza)✎
MattJ
Ultimately they are a per-deployment decision, but the RFC gives you at least "10000 bytes" (for the whole stanza) ✏
jubalhhas left
MSavoritias (fae,ve)has left
techmetx11has left
TheRealkaranohas left
MattJ
Recent Prosody and ejabberd use 256KB on c2s and 512KB on s2s by default
techmetx11has joined
MSavoritias (fae,ve)has joined
TheRealkaranohas joined
inkyhas left
raghavgururajanhas joined
nicoco
thanks MattJ. So let's introduce an --avatar-size config parameter then, along with a `TODO: cache this` near the resampling operation… ^^
TheRealkaranohas left
TheRealkaranohas joined
amee2khas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
adxhas left
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
adxhas joined
TheRealkaranohas left
TheRealkaranohas joined
antranigvhas joined
TheRealkaranohas left
TheRealkaranohas joined
xeckshas left
larmahas joined
mhhas left
TheRealkaranohas left
TheRealkaranohas joined
mhhas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
Kevhas left
Kevhas joined
TheRealkaranohas left
TheRealkaranohas joined
Laurahas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
uhas joined
TheRealkaranohas left
TheRealkaranohas joined
adxhas left
TheRealkaranohas left
TheRealkaranohas joined
Wojtekhas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
amee2khas left
amee2khas joined
TheRealkaranohas left
TheRealkaranohas joined
uhas left
uhas joined
TheRealkaranohas left
TheRealkaranohas joined
PapaTutuWawahas left
TheRealkaranohas left
TheRealkaranohas joined
nicoco
wait wait wait, but where does that "too-large: 4096 bytes" come from then?
TheRealkaranohas left
MattJ
How large is your stanza?
TheRealkaranohas joined
antranigvhas left
zawarudohas left
TheRealkaranohas left
TheRealkaranohas joined
nicoco
I don't know for sure, but > 512KB probably. I was just curious where the 4096 came from? Does it mean it's exactly 4KiB too large? (just want to make sure I really understand where the error is coming from)
MattJ
Oh, no
Zash
Block size
MattJ
The full 512KB is not read from the socket and pushed to the XML parser in one big blob
MattJ
This debug message is just telling you about the error raised while processing this chunk of XML it is showing you
MattJ
4096 is not the stanza size
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
Zash
It reads from the socket in chunks of configurable size, defauling to 4k iirc. That's then the size it reports that it showed in the log
TheRealkaranohas joined
techmetx11has left
techmetx11has joined
xeckshas joined
TheRealkaranohas left
TheRealkaranohas joined
Kevhas left
Martinhas left
TheRealkaranohas left
TheRealkaranohas joined
Kevhas joined
Martinhas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
sonnyhas left
sonnyhas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
Kevhas left
TheRealkaranohas left
TheRealkaranohas joined
zawarudohas joined
Kevhas joined
TheRealkaranohas left
TheRealkaranohas joined
adxhas joined
antranigvhas joined
TheRealkaranohas left
TheRealkaranohas joined
zawarudohas left
TheRealkaranohas left
TheRealkaranohas joined
inkyhas joined
xeckshas left
xeckshas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
zawarudohas joined
Mx2has left
antranigvhas left
antranigvhas joined
TheRealkaranohas left
TheRealkaranohas joined
nikhas joined
Schimon_has left
Schimon_has joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
inkyhas left
Kevhas left
Kevhas joined
TheRealkaranohas left
TheRealkaranohas joined
amee2khas left
amee2khas joined
TheRealkaranohas left
TheRealkaranohas joined
larmahas left
antranigvhas left
zawarudohas left
TheRealkaranohas left
TheRealkaranohas joined
zawarudohas joined
TheRealkaranohas left
TheRealkaranohas joined
kikuchiyohas left
TheRealkaranohas left
TheRealkaranohas joined
kikuchiyohas joined
inkyhas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
nicoco
oh OK, so it's not a stanza size problem, but a base64 encoding problem I guess? I fail to reproduce it now and did not keep the [some-data] content unfortunately :/
uhas left
TheRealkaranohas left
zawarudohas left
TheRealkaranohas joined
uhas joined
TheRealkaranohas left
TheRealkaranohas joined
MattJ
It's a stanza size problem
kikuchiyohas left
nicoco
oh ok, got it, prosody just logs the "chunk that made us go beyond the size limit"
MattJ
Exactly
jubalhhas joined
inkyhas left
nicoco
thanks, let's resample these images then. it's annoying to estimate what the final stanza size will be, but I'll default to 200×200 max, I think it's reasonable. then if someone wants to increase the limit in their server parameters, they can make this max size as huge as they want.
nikhas left
techmetx11has left
nikhas joined
TheRealkaranohas left
techmetx11has joined
TheRealkaranohas joined
inkyhas joined
amee2khas left
amee2khas joined
TheRealkaranohas left
TheRealkaranohas joined
kikuchiyohas joined
MattJ
Yeah. I know at least one client that just reduces the scale in a loop until the right size is achieved 🙂
PapaTutuWawahas joined
TheRealkaranohas left
TheRealkaranohas joined
xeckshas left
kikuchiyohas left
TheRealkaranohas left
TheRealkaranohas joined
jubalhhas left
TheRealkaranohas left
TheRealkaranohas joined
inkyhas left
kikuchiyohas joined
TheRealkaranohas left
TheRealkaranohas joined
nikhas left
nikhas joined
TheRealkaranohas left
TheRealkaranohas joined
nicocohas left
nicocohas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
Kevhas left
Kevhas joined
TheRealkaranohas left
TheRealkaranohas joined
nikhas left
nikhas joined
atomicwatchhas left
TheRealkaranohas left
TheRealkaranohas joined
amee2khas left
TheRealkaranohas left
TheRealkaranohas joined
goffihas left
nicoco
i think if you go for uncompressed PNG you can predict the size, but with compression enabled, I don't think you can avoid a loop if you want to maximise the resolution while fitting the stanza size. setting a low default value seemed more reasonable to me (those precious CPU cycles!), but it does not feel great either
TheRealkaranohas left
TheRealkaranohas joined
nikhas left
nikhas joined
goffihas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
Zashhas left
TheRealkaranohas joined
inkyhas joined
Zashhas joined
TheRealkaranohas left
TheRealkaranohas joined
heartyhas left
TheRealkaranohas left
TheRealkaranohas joined
antranigvhas joined
Kevhas left
Kevhas joined
Samhas left
Wojtekhas left
TheRealkaranohas left
nikhas left
TheRealkaranohas joined
nikhas joined
xeckshas joined
atomicwatchhas joined
Wojtekhas joined
me9has joined
TheRealkaranohas left
TheRealkaranohas joined
Samhas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
Samhas left
heartyhas joined
goffihas left
goffihas joined
MSavoritias (fae,ve)has left
MSavoritias (fae,ve)has joined
nikhas left
nikhas joined
jubalhhas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
nephelehas joined
Alexhas left
Samhas joined
Alexhas joined
nephelehas left
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
Wojtekhas left
nephelehas joined
nephelehas left
TheRealkaranohas left
TheRealkaranohas joined
Samhas left
TheRealkaranohas left
TheRealkaranohas joined
MSavoritias (fae,ve)has left
MSavoritias (fae,ve)has joined
Samhas joined
zawarudohas joined
Kevhas left
Kevhas joined
nephelehas joined
heartyhas left
nephelehas left
heartyhas joined
uhas left
uhas joined
TheRealkaranohas left
TheRealkaranohas joined
TheRealkaranohas left
TheRealkaranohas joined
lovetox
Could you not calculate the max size of any given PNG size?
lovetox
Like there must exist a number where a 64x64 PNG with a specific compression setting can go above✎
lovetox
Like there must exist a number where a 64x64 PNG with a specific compression setting cant go above ✏
lovetox
Like a worst case compressible picture
nicoco
well it can't go above the uncompressed version, for sure :)