FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » FUDforum Suggestions » Getfile mysql_close()?
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
Getfile mysql_close()? [message #164693] Mon, 28 February 2011 23:12 Go to next message
Ernesto is currently offline  Ernesto   Sweden
Messages: 413
Registered: August 2005
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
If you are grabbing a large file attachment with getfile.php.t it will keep the current mysql connection in sleepmode until the file finishes downloading. This might make you reach your max_connections or max_user_connections in mysql since the processess will sit in sleepmode until the script finishes.

I tried adding a db_close() function to db.inc but it seems I cannot call that from getfile.php.t.

Do I have to make those functions global somehow, or should I define that function somewhere else? I figured it would be correct to do it in db.inc since we have the fud_sql_connect variable defined there, so that we can easier access the proper string for mysql_close().

I tried running mysql_close() with the global variables in it, but that didn't close the connection, shouldn't that work?

IE - close the mysql connection just before we run @readfile($r[2]); and that would hopefully not keep a connection open while the user has the run/save/cancel box open (or while they download the file)

Anyone have any suggestions, other than raising the max_connections in mysql.


Re: Getfile mysql_close()? [message #164694 is a reply to message #164693] Mon, 28 February 2011 23:13 Go to previous messageGo to next message
Ernesto is currently offline  Ernesto   Sweden
Messages: 413
Registered: August 2005
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
The above applies even if you do not use persistant connections. (That you cannot close with mysql_close())

Maybe switching to persistant connections would actually help since it could then perhaps pick up the sleeping threads/processes and use them?


Re: Getfile mysql_close()? [message #164700 is a reply to message #164694] Wed, 02 March 2011 04:51 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3624
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
The key is to add db_close() to the correct db.inc file and rebuild your themes afterwards.

I'll include it with the next release.
Re: Getfile mysql_close()? [message #164704 is a reply to message #164693] Wed, 02 March 2011 05:29 Go to previous messageGo to next message
Ernesto is currently offline  Ernesto   Sweden
Messages: 413
Registered: August 2005
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
Alright, so I shouldn't add it to db.inc.t in my thm folder, but rather in the admin/include one? (or wherever it was)

Re: Getfile mysql_close()? [message #164707 is a reply to message #164704] Wed, 02 March 2011 05:40 Go to previous message
naudefj is currently offline  naudefj   South Africa
Messages: 3624
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
Add it to [FUDdata]/sql/[db driver]/db.inc.
Where [db driver] is one of {mysql, pdo_mysql, sqlite, etc.}

PS: db.inc.t is just a copy of the sql/[db driver]/db.inc file (see compiler.inc).
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: Setting Notification w/body as a per-user option and editing email template
Next Topic: two ideas - Bookmarks and Taxonomy
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Oct 17 05:50:31 EDT 2017

Total time taken to generate the page: 0.00646 seconds