LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > Ruby/Rails > Strange interference between LSAPI, popen3 and MySQL

Reply
 
Thread Tools Display Modes
  #1  
Old 03-04-2007, 10:59 AM
andreas andreas is offline
Senior Member
 
Join Date: Aug 2006
Posts: 91
Default 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.
Reply With Quote
  #2  
Old 03-04-2007, 06:38 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
OK, we will take a closer look at this. Thanks for the bug report.
Reply With Quote
  #3  
Old 03-05-2007, 02:45 AM
andreas andreas is offline
Senior Member
 
Join Date: Aug 2006
Posts: 91
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
Reply With Quote
  #4  
Old 03-09-2007, 09:27 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
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.
Reply With Quote
  #5  
Old 03-09-2007, 09:52 AM
andreas andreas is offline
Senior Member
 
Join Date: Aug 2006
Posts: 91
Example: Open3.popen3('/bin/touch', '/tmp/popen3_is_OK'). It doesn't work when used from LSAPI.
Reply With Quote
  #6  
Old 03-09-2007, 12:41 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
Ok, this issue is resolved, please check the updated thread
http://www.ruby-forum.com/topic/99988
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:42 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.