mysql_connect => Error in my_thread_global_end(): 3 threa

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
amnontoo
Forum Newbie
Posts: 2
Joined: Wed Jul 25, 2007 5:10 pm

mysql_connect => Error in my_thread_global_end(): 3 threa

Post by amnontoo »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Short version of my problem: 

Any call to mysql_connect() eventually generates a hang and a "Error in my_thread_global_end(): 3 threads didn't exit." However, the PHP code and the calls to the SQL server all work fine. I am using MySQL 5.0.45 and PHP 5.2.3 on Windows XP Pro IIS. 

Thanks for any help! I am completely stuck on this. 


Long version: 

This code always hangs: 
--------------------------------------------

Code: Select all

<?php 
echo('Started<br>'); 
$host="127.0.0.1:7777"; 
$dbuser="root"; 
$password="mypassword"; 
mysql_connect($host,$dbuser,$password); 
echo('Finished<br>'); 
?>
--------------------------------------------



Here is the output:

--------------------------------------------
Started
Finished
Error in my_thread_global_end(): 3 threads didn't exit
--------------------------------------------

I get the same thing if I use
mysql_close();
or if I use
$h=mysql_connect($host,$dbuser,$password);
mysql_close($h);
or if I use $host="localhost:7777";


Any code I use that includes mysql_close has the same problem. I uninstalled MySQL and PHP, deleted the directories, rebooted, did a fresh install as shown below. Same problem.

Calls to mysql_query() work fine however. The problem only happens at the end of the script.

Any ideas? Thanks for looking!!!

Here are the installation options I used:

Installed MySQL 5.0.45
Enabled TCP/IP on port 7777
Transactional DB only
Include BIN path
Make root password: mypassword

Install PHP 5.2.3
IIS CGI
MySQL extension


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Thread split from here.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

So that seems to be a pretty common error message. Does anyone have any idea what app is throwing that error?
amnontoo
Forum Newbie
Posts: 2
Joined: Wed Jul 25, 2007 5:10 pm

Post by amnontoo »

I found that the error
Error in my_thread_global_end(): 1 thread didn't exit
can happen in MySQL with the command line, if I hit ctrl-C while in the console.
So this error must be from the MySQL server. But I can't tell why it always happens with PHP.
I think my page never seems to finish loading, MySQL gets tired of waiting, and it sends out this error. I don't know why.

I found an (ugly) work around. I can have my PHP page do its MySQL stuff, and then redirect the browser to another page with a line of Javascript at the end of the page. If the page doesn't sit stuck waiting to load, the error doesn't happen.

Here is my guess at what is going wrong:
PHP thinks there is more work to do and never finishes the connection. If the connection hangs open too long, MySQL gets terminated improperly or something, and that causes the error about the threads not exiting.
Post Reply