Hi everyone, As a follow-up to my earlier mails about being unable to go online with a Solaris 9 (Sparc) machine, here are some findings:
During the logon-process, SendEvent_Server 'forks' off a thread for every new packet to be sent (see ProcessRunningEvent_Server_tep in icqthreads.cpp). These threads (as far as I can see) only have to send a packet to the server, and then they close. Because so many threads are spawned at the same time, there are no guarantees as to the order of their execution. And although Solaris 8 (and a lot of other Unices apparently) does happen to schedule them in order of creation, Solaris 9 sometimes reverses this order. And this might also happen on other platforms, especially multi-CPU machines. Essentially this is a race-condition, and whether (or how often) it causes a problem depends on the particular pthreads implementation, but probably also on server load, network load and fase of the moon. I've tried a quick-and-dirty workaround, by adding an usleep(50000); statement right after the thread creation (icqd.cpp line 956) to ensure each thread has ample time to get scheduled and fire off it's packet. This way I can successfully log onto ICQ once again. I see two 'proper' solutions to this problem: To not use a thread for merely sending off a packet, especially if these have to be sent out in a specific order to not upset the ICQ-server. One would only have to incorporate the functionality within the ProcessRunningevent_Server_tep into SendEvent_Server, so no thread gets forked off, to achieve this. Another solution might be to use some form of locking within the threads. One way to implement this would be to keep track of the sequence numbers already sent out, and only allow the thread to send when it's packet would be next in line. I'm rather new to the Licq-code and to threads so I hope I'm not just imagining things here. If however the more seasoned Licq-developers agree with these findings, I'll be glad to try and help implement these or other changes. Regards, Paul Boven. -- ------------------------------------------------------------------ | "Rules exist to make you think before you break them" - Lu-Tze | ------------------------------------------------------------------ | Paul Boven <[EMAIL PROTECTED]> PE1NUT QRV 145.575 | ------------------------------------------------------------------ ~ ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Licq-main mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/licq-main
