LiteSpeed Support Forums

LiteSpeed Support Forums (http://www.litespeedtech.com/support/forum/index.php)
-   Ruby/Rails (http://www.litespeedtech.com/support/forum/forumdisplay.php?f=20)
-   -   Strange interference between LSAPI, popen3 and MySQL (http://www.litespeedtech.com/support/forum/showthread.php?t=902)

andreas 03-04-2007 10:59 AM

Strange interference between LSAPI, popen3 and MySQL
 
(I have cross-posted this question to ruby-lang: http://www.ruby-forum.com/topic/99988)

I am experiencing a very strange problem in my Rails app. I use popen3
to execute an external program. Everything works fine in Mongrel, but
when I use the app with LSAPI, after popen3 all MySQL queries fail with
"Mysql::Error (MySQL server has gone away)". Once I comment out popen3
it works fine again.

The problem is easy to reproduce in any Rails app using LSAPI and MySQL.
Add the following to a controller action:

require 'open3'
Open3.popen3('/usr/bin/ls') {|stdout, stdin, stderr| stdin.read }

The stdin.read is important.

mistwang 03-04-2007 06:38 PM

OK, we will take a closer look at this. Thanks for the bug report.

andreas 03-05-2007 02:45 AM

I could work around the MySQL problem, but popen3 does not work. I have posted some more information in this thread:
http://www.ruby-forum.com/topic/99988

mistwang 03-09-2007 09:27 AM

I found that MySQL connection will be lost even in Mongrel, so it is not a problem LSAPI specific.
As to popen3 not working, what kind of result is expected? seems I did not get any meaningful output under Mongrel as well.

andreas 03-09-2007 09:52 AM

Example: Open3.popen3('/bin/touch', '/tmp/popen3_is_OK'). It doesn't work when used from LSAPI.

mistwang 03-09-2007 12:41 PM

Ok, this issue is resolved, please check the updated thread
http://www.ruby-forum.com/topic/99988


All times are GMT -7. The time now is 11:47 PM.