IPC not calling back on multiple threads
Posted: Tue Apr 15, 2014 9:53 pm
Hello Madshi!
Using latest release of MadCollection 2.7.8 released December, 2013 (and also tried old release from 2012), I call CreateIpcQueue() or CreateIpcQueueEx(..., 16) to specify multiple worker threads for the IPC. The problem is that the callback thread is almost always the same one, and since my app can take a couple seconds to return an IPC answer, the hooked app freezes unusable. It is fine if the callbacks are properly called on different worker threads (at peak, about 10 IPC messages per second are generated, so 16 threads are more than enough).
Really strange - this behavior depends on which app the SendIpcMessage() is called from! I am hooking browser apps, hooking the Winsock API 'WSASend', and in the hook proc for this, I call SendIpcMessage(). Get this:
1) On IE, the IPC callback is called on different threads, and it is fine.
2) On Chrome, the IPC callback is called on the same thread (only the second time is it different, then it goes back to the first thread for all the rest)
3) On Firefox, same as #2, but the API being hooked is 'send' instead of 'WSASend'.
Madshi, how does SendIpcMessage() determine which worker thread to call the IPC callback on? It seems to be getting confused in Chrome and Firefox.
Thanks,
David
Using latest release of MadCollection 2.7.8 released December, 2013 (and also tried old release from 2012), I call CreateIpcQueue() or CreateIpcQueueEx(..., 16) to specify multiple worker threads for the IPC. The problem is that the callback thread is almost always the same one, and since my app can take a couple seconds to return an IPC answer, the hooked app freezes unusable. It is fine if the callbacks are properly called on different worker threads (at peak, about 10 IPC messages per second are generated, so 16 threads are more than enough).
Really strange - this behavior depends on which app the SendIpcMessage() is called from! I am hooking browser apps, hooking the Winsock API 'WSASend', and in the hook proc for this, I call SendIpcMessage(). Get this:
1) On IE, the IPC callback is called on different threads, and it is fine.
2) On Chrome, the IPC callback is called on the same thread (only the second time is it different, then it goes back to the first thread for all the rest)
3) On Firefox, same as #2, but the API being hooked is 'send' instead of 'WSASend'.
Madshi, how does SendIpcMessage() determine which worker thread to call the IPC callback on? It seems to be getting confused in Chrome and Firefox.
Thanks,
David