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

Home » FUDforum » FUDforum Suggestions » Getfile mysql_close()?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Getfile mysql_close()? [message #164693] Tue, 01 March 2011 04:12 Go to next message
Ernesto is currently offline  Ernesto   Sweden
Messages: 413
Registered: August 2005
Karma: 0
Senior Member
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] Tue, 01 March 2011 04:13 Go to previous messageGo to next message
Ernesto is currently offline  Ernesto   Sweden
Messages: 413
Registered: August 2005
Karma: 0
Senior Member
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 09:51 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
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 10:29 Go to previous messageGo to next message
Ernesto is currently offline  Ernesto   Sweden
Messages: 413
Registered: August 2005
Karma: 0
Senior Member
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 10:40 Go to previous message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
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).
  Switch to threaded view of this topic Create a new topic Submit Reply
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: Sun Nov 24 22:05:43 GMT 2024

Total time taken to generate the page: 0.02324 seconds