Race condition? (4)

1 Name: Anonymous : 2006-07-30 03:32 ID:ULvDO9Uj [Del]

I was hacking on wakaba sources lately, and one thing caught my attention.

Wakaba seems to update HTML files without synchronisation of any kind. Using temporary files wards of corrupted files, but it seems that at least 'page cache' can be out-of-date if two posts happen simultaneously -- two instances build temporary files and one, which updated database first, updates pages last -- one comment is lost.

Or am I just missing something?

2 Name: !WAHa.06x36 : 2006-07-30 04:40 ID:okls1YYK [Del]

No, that's definitely the case. However, on a board that's active enough that such a simultaneous update has any real chance of occurring, another update will happen soon enough that I don't think there's any real incentive to add extra code to work around this. Unless you have a quick and simple fix for it.

3 Name: coda : 2006-08-01 16:16 ID:gaE4GUu7 [Del]

a quick and simple fix, yes?

# in post_stuff()
# after "# proxy check"
$dbh->do("LOCK TABLES ".SQL_TABLE." WRITE");
# before "# set the name, email and password cookies"
$dbh->do("UNLOCK TABLES");

N.B. the implications of this code: all posts are serialized, which means some requests will take a very long time to execute, tying up a mysql connection slot all the while.

4 Name: Anonymous : 2006-08-01 23:43 ID:za82JnBt [Del]

>>3
Will this only work with MySQL? Lock files may be a better solution.

Peformance should not be the problem, since, as 2-san mentioned, this is unlikely condition after all.

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification: