"temptables found when disposing database", again!

Picture of Alan Zaitchik
"temptables found when disposing database", again!

I know there are lots of posts about "temptables found when disposing database" but I think my problem is different.

I wrote a plugin very like the LDAP Authentication plugin, for Moodle 2.2. When we execute sync_users we see the error message (in the error log)

Potential coding error - existing temptables found when disposing database. Must be dropped!

but the actual synchronization works like a charm. All user accounts are created or updated as they should. I have made sure that there is no duplication of usernames, no extra subcontexts that are being searched, and so on for all the other factors discussed in existing posts about this issue.

In the MySQL log (after I turned on logging) I can see

            7 Query    INSERT INTO mdl_user (firstname,lastname,email,city,country,idnumber,username,timecreated,timemodified,confirmed,auth,mnethostid,deleted,lang) VALUES('Alan','Zaitchik','','Waco, Texas','US','4E592EF9-D5EE-459E-A4E3-D19CD1BBA0CF','azaitchik','1358801663','1358801663','1','jics','1','0','en')
            7 Query    COMMIT
            7 Query    SHOW TABLES
            7 Query    DROP TABLE mdl_tmp_extuser
            7 Query    SHOW TABLES
            7 Query    DROP TEMPORARY TABLE mdl_tmp_extuser
            7 Quit   

Is it normal for there to be both a DROP TABLE and a DROP TEMPORARY TABLE?

Note that when I use this same plugin in the 2.3 environment there is no error message. Looking in the MySQL log I also see no "extra" DROP TABLE statement.

Where could that statement be coming from in the Moodle 2.2.5 code? It is not in the plugin code, at least not directly.The only remoteely relevant thing I can find between the call to

$id = $DB->insert_record('user', $user);

and the call to


is a call to


Is that relevant? FWIW in the Moodle 2.2.5 case I also see the following in the Apache error log. This is not found in the 2.3 Moodle site so I assume it is caused by the temp table issue, but I really have no idea why.

PHP Fatal error:  Exception thrown without a stack frame in Unknown on line 0

Remember-- as I said -- the actual synchronization of user accounts IS working, despite the error messages!

Average of ratings: -