plainblack.com
Username Password
search
Bookmark and Share

    

Couldn't write to the database: insert into userSession ... Duplicate entry

User terminus
Date 2/9/2010 11:57 pm
Views 398
Rating 0    Rate [
|
]
Previous · Next
User Message
terminus

I have two broken WebGUI sites producing these errors in webgui.log:

2010/02/09 22:45:47 - FATAL - webgui.conf - WebGUI::SQL::write[814] - Couldn't write to the database: insert into userSession values ('M9ANEHpMftXIfwVMpnoBIA', 1297309547, 1265773547, 0, '174.37.205.76', '1') : Duplicate entry 'M9ANEHp' for key 1

(The corresponding error in the browser is simply "We have encountered a problem with your request. Please use your back button and try again...".)

It seems that WebGUI is trying to insert a userSessionID that is too long - 22 characters rather than the allowed 7.  But altering the userSession table (along with userSessionScratch) to raise sessionID from varchar(7) to varchar(22) doesn't help, except that the error message changes:

2010/02/09 22:48:23 - ERROR - webgui.conf - WebGUI::Operation::execute[63] - Couldn't execute operation : WebGUI::Operation::Auth::www_auth. Root cause: Can't call method "process" on an undefined value at /var/www/WebGUI/lib/WebGUI/Auth.pm line 211

(The corresponding error in the browser is "Can't call method "www_view" on an undefined value at /var/www/WebGUI/lib/WebGUI.pm line 121".)

Emptying the userSession (and userSessionScratch) tables doesn't help, either, whether or not I also delete the cache.  This problem has only arisen suddenly, and doesn't affect other WebGUI sites on the same machine.  Can anyone help me?

It is indeed true that I am running an older version of WebGUI, and if you would advise me to upgrade, then I'll do that... but not until after I've resolved this problem.  I'm worried that attempting to upgrade while the site is in a broken state will only make things worse.

--- (Edited on 2/9/2010 11:57 pm [GMT-0600] by terminus) ---



Back to Top
Rate [
|
]
 
 
preaction

What version are you running? When did this start happening? What was being done when this started happening?

It looks to me like an upgrade gone wrong.

--- (Edited on 2/10/2010 12:34 am [GMT-0600] by preaction) ---



Back to Top
Rate [
|
]
 
 
terminus

Well, this is when you're going to laugh at me; it's version 6.7.7.  But if something ain't broke (which it wasn't until now), why upgrade it?

This started pretty recently, because the Google Cache versions of the working sites were still available as of yesterday.  There was no attempted upgrade, though.  In fact, I honestly haven't touched this hosting machine for weeks.

What I have noticed is that there are a lot of spam comments in both sites.  So I suspect this started happening when a bot went crazy and spawned too many sessions, or something, and a value in the userSession table overflowed.  That's why I tried to empty that table - but it didn't work, so I guess the SessionID is incremented in some way that I don't understand.

Apart from emptying the sessions tables to try to fix this problem, I haven't messed with WebGUI in any way (my alteration to sessionID has been reversed).

--- (Edited on 2/10/2010 12:53 am [GMT-0600] by terminus) ---



Back to Top
Rate [
|
]
 
 
preaction

Looking back through old versions of WebGUI, I cannot find a version where a sessionId was ever less than 22. The 4.x, 5.x and 6.0-6.4 all have sessionId as VARCHAR(60). Starting with 6.5.x, sessionId was changed to VARCHAR(22).

The second error ( Can't call method "process" on an undefined value at /var/www/WebGUI/lib/WebGUI/Auth.pm line 211 ) is caused because the Create Account template you have set does not exist. You should look at your Settings and make sure the Create Account template exists.

--- (Edited on 2/10/2010 11:39 am [GMT-0600] by preaction) ---



Back to Top
Rate [
|
]
 
 
terminus

Hmm, weird.  I still don't know how those two databases got screwed up, unless I've been the victim of an SQL injection attack or something, by the spammers who have been abusing the two sites.  One day the sites were working, the next they weren't... so the table structure must have been changed in between, and it wasn't by me.

Anyway, after your last message I found some other fields of the tables in question that were wrong, and I wasn't confident that I would be able to catch all the problems in any other way, so in the end I dumped the table structure from one of my working sites, and the data from my broken sites, and combined the two, and all is working again.

Thanks for your help.

--- (Edited on 2/12/2010 1:36 pm [GMT-0600] by terminus) ---



Back to Top
Rate [
|
]
 
 
    



© 2012 Plain Black Corporation | All Rights Reserved