Sorry, many ignorant questions incoming.
(In reply to Dragana Damjanovic [:dragana] from comment #4)
This crash when creating a ipc message. In this case, the scrip is producing too many SendSetCookie messages and cookie service is not fast enough to consume them. The same problem can be produce with other means as well.
Are we running into buffering problems at the actual OS-specific IPC layer (blocking the I/O thread on sendmsg() or the like) or are we just repeatedly calling SendSetCookieString, and we're serializing everything into IPC messages, and then we're queueing all those IPC messages, and that causes us to run out of RAM? I'm assuming we're doing the latter?
Is it possible for the cookie service ipc parts to coalesce cookie sets somehow? Like here:
since we're already sending that message asynchronously, couldn't we queue up a runnable to do the actual SendSetCookieString, and then repeatedly update that runnable with the most recent cookie set, until at some point the runnable sends off the latest cookie set, and then we start with a new runnable? I'm not exactly sure where that runnable should run, though...
Can we look at a more common solution. Should we flow control the ipc buffer? We do a flow control of OnDataAvailable messages for example.
I didn't know we flow controlled OnDataAvailable! I'd like to learn about this; where do we do that?
Assuming the above scenario is correct--we're creating so many IPC messages that we run out of memory before we can send them all out--I think this is proposing something like blocking during IPC message creation until the IPC queue is an appropriate size? Or I guess we could always permit IPC messages to be created, but then when they got inserted into the queue, we'd block if the queue had some N MB of messages already pending, or something like that?
Assuming I'm understanding correctly, that sounds kind of reasonable! It feels like the better thing is to investigate whether we can improve the cookie service in some way, but I don't know whether that's just my reluctance to touch the IPC layer, a drastic misunderstanding of how the cookie service works, or something else entirely.