Laurent Sansonetti
lsans****@apple*****
Sat Jul 21 09:43:38 JST 2007
Doesn't fix the problem (on tiger/ppc). I had the same idea :-( Laurent On Jul 21, 2007, at 2:28 AM, Fujimoto Hisa wrote: > このパッチをあてたらどうなるでしょうか? > > > Index: framework/src/objc/mdl_osxobjc.m > =================================================================== > --- framework/src/objc/mdl_osxobjc.m (revision 1928) > +++ framework/src/objc/mdl_osxobjc.m (working copy) > @@ -382,7 +382,5 @@ > > rb_define_module_function(mOSX, "__rebind_umethod__", > osx_mf_rebind_umethod, 2); > > - thread_switcher_start(); > - > initialize_bridge_support(mOSX); > } > > > On 7/21/07, Satoshi Nakagawa <snaka****@infot*****> wrote: >> Hi. >> >> I found a problem, application stalls on thread context switches of >> Ruby. >> It is reproducible on 0.11.1 and trunk. >> >> How to reproduce the problem: >> >> 1. Start a socket server. >> 2. Connect to the server using Ruby's TCPSocket. >> 3. The server accepts the request. >> 4. Start a thread on the server, sending 256KB per 5 seconds to >> the client. >> 5. The application stalls. (Rolling rainbow colored cursor forever) >> >> Reproduce code in Xcode project: >> >> http://limechat.net/rubycocoa/ThreadedSocketTest.zip >> >> In #4, if it sends 64KB per 5 seconds, there are no problem. >> >> This is the code around threaded writing from server to client. >> >> def write_loop >> loop do >> puts '+++ start writing' >> @sc.write('a' * (1024 * 256)) >> puts '--- end writing' >> sleep 5 >> end >> end >> >> The log when it sends 256KB: >> >> +++ start writing >> (stalls) >> >> The log when it sends 64KB: >> >> +++ start writing >> --- end writing >> *** received >> *** received >> (continues forever) >> >> So I noticed the application stops at: >> >> @sc.write('a' * (1024 * 256)) >> >> It seems to occur on thread context switches of Ruby. >> Then, I added a logging code to RubyCocoa: >> >> Index: framework/src/objc/RBThreadSwitcher.m >> =================================================================== >> --- framework/src/objc/RBThreadSwitcher.m (revision 1928) >> +++ framework/src/objc/RBThreadSwitcher.m (working copy) >> @@ -44,6 +44,7 @@ >> - (void) sched: (NSTimer*)a_timer >> { >> + NSLog(@"@@@ timer"); >> CHECK_INTS; >> if (!rb_thread_critical) rb_thread_schedule(); >> } >> >> Then the log is (sends 256KB): >> >> +++ start writing >> 2007-07-21 08:38:34.247 BridgeTest2[2990] @@@ timer >> (stalls) >> >> It shows the application stalls after a thread context switch of >> Ruby. >> >> -- >> Satoshi Nakagawa >> >> _______________________________________________ >> Rubycocoa-devel mailing list >> Rubyc****@lists***** >> http://lists.sourceforge.jp/mailman/listinfo/rubycocoa-devel >> > > > -- > hisa > > _______________________________________________ > Rubycocoa-devel mailing list > Rubyc****@lists***** > http://lists.sourceforge.jp/mailman/listinfo/rubycocoa-devel