Ticket #18 (new code bug)

Opened 18 months ago

Last modified 16 months ago

"Duplicate entry 'flash:(hex)' for key 1" when loading pages simultaneously

Reported by: eevee Owned by: eevee
Priority: major Component: framework
Keywords: catalyst Cc:
Difficulty:

Description

Obviously something about Catalyst::Plugin::Session. Investigate.

Attachments

Change History

Changed 16 months ago by eevee

So.. also happens with session:(hex).

Also, this essentially comes down to a race condition with DBIx::Class::ResultSet::find_or_create. It checks for the existence of the requested row, and if none is found, one is created. Since these are two separate queries, if it's running twice at the same time with the same primary key, it's possible for one thread to create the row just after the second thread checks for the row's existence, at which point the second thread will also try to create the row.

There's a thread about this on the DBIx::Class mailing list, so it may or may not be fixed somehow in the next release: http://lists.scsys.co.uk/pipermail/dbix-class/2007-July/004693.html (Since that's from the tail end of July, any more followups will become part of August: http://lists.scsys.co.uk/pipermail/dbix-class/2007-August/thread.html) If not, I'll just have to inject a wrapper that eval{}s the find_or_create call and calls create() again if necessary. Might do it anyway. I tried a solution with r270, but due to differing versions of the Session::DBIC plugin, it doesn't seem to have worked.

Changed 16 months ago by eevee

Currently fixed in my checkout, but I hate the fix with an undying passion.

Add/Change #18 ("Duplicate entry 'flash:(hex)' for key 1" when loading pages simultaneously)

Author



Action
as new
 
Note: See TracTickets for help on using tickets.