-
lovetox
so im running into a problem with ejabberd since a long time
-
lovetox
when i join many MUCs (hence much traffic)
-
lovetox
it seems ejabberd sends me stanzas and i dont get the chance to ack them until ejabberd runs into some stream management queue limit
-
lovetox
and aborts the connection
-
lovetox
so back then i just thought ok maybe my network code is shitty, lets rewrite this, but its still happening, and i dont really get what i could do better
-
lovetox
there is a outgoing connection and incoming connection, i have callbacks on both when they are "ready"
-
lovetox
and if they are ready, i write or receive data
-
lovetox
and if they are ready is decided by GLib
-
lovetox
so i didnt write the socket code
-
lovetox
i dont know why the outgoing connection does not become ready .. maybe because of the other side, but thats just a guess
-
lovetox
does any developer here have special code that somehow handles this case
-
Kev
You haven't got something going on like "I'll only write to the socket once I'm done reading from it" have you?
-
Kev
That's what the problem sounds like.
-
lovetox
no i definitly dont have that
-
lovetox
GLib abstracts that
-
jonas’
lovetox, are you sure that glib will let you alternate between read and write if both are possible?
-
lovetox
i get a callback when the socket is ready, either to receive or to write
-
lovetox
and when i get that callback i use it to do exactly that
-
lovetox
no im not sure, but how do other devs tackle that problem, do you explicitly after X bytes received, send stuff?
-
jonas’
my event loop takes care of that
-
jonas’
but I don’t trust glib
-
lovetox
how?
-
jonas’
(my event loop = asyncio.whateverthedefaulteventlooponlinuxis)
-
jonas’
but asyncio has write queues, so I *expect* it to write things from the queues when possible and only then hand me read callbacks.
-
lovetox
ok i expect also things from GLib, so you don't handle that case yourself
-
jonas’
lovetox, I suggest you go and read the glib source code
-
lovetox
thing is i had that problem when i used python network code
-
lovetox
and i only ever had it with ejabberd
-
jonas’
prosody has no stream management queue size limits AFAIK
-
jonas’
s/prosody/the unofficial mod_smacks/
-
jonas’
ok, I checked asyncio; it will alternate between readers and writers. each iteration of the loop collects ready events and then processes them
-
Kev
I don't know what the issue is, but what you're describing is 100% the behaviour you'd get if you don't bother writing until you're done reading, and there's a lot of data to read.
-
Kev
So I'm aware of implementations that manually alternate to avoid reading from the queue forever.
-
lovetox
yeah i know this sounds like that
-
lovetox
maybe it is, maybe i should ask the GLib guys if they alternate between the streams
-
jonas’
lovetox, just read the source
-
jonas’
that’s the least ambiguous answer you’ll get