race-condition

Race condition and using Google Analytics Asynchronous (_gaq) synchronously

I have a website which is using Google Analytics newer asynchronous tracking method (_gaq). The problem I've run into is that I want to institute some specific link tracking and am worried that I will be creating a race condition. Basically, it's a news website so it has headlines which link to stories all over the place. A headline for...

Race Condition without Threads?

Let's say I have: sample.c int main (...) { char str*; get s through user input test(str); return 0; } void test (str) { copy str to new file change file permissions on new file close file } There's no possibility of a race condition here since I have no threads in my main() method. Is that true? ...

Unlocked, shared hash operation safety in threaded perl

Question Is it safe for multiple threads to fetch and store simple, individual values in a shared hash without lock()ing the hash? Can you prove it or cite strong authority? Background My belief was that at worst unlocked hash manipulations could lead to segfaults. However, I've very recently seen code that coordinates worker thread...

MATLAB GUIDE gui listbox intermittently disappears with seemingly obsolete error

I am building a straightforward MATLAB gui using GUIDE. I have a listbox of items. Most of the time, it works as expected, but sometimes (usually after I edit the figure with GUIDE) populating the listbox causes it to disappear, along with this message: Warning: single-selection listbox control requires a scalar Value Control will not b...

Handling race condition in model.save() (Django)

How should one handle a possible race condition in a model's save() method? For example, the following example implements a model with an ordered list of related items. When creating a new Item the current list size is used as the its position. From what I can tell, this can go wrong if multiple Items are created concurrently (will it...

Does this suffice, or do I have race conditions?

I'm writing a strategy-kind of multi user game for the web. It has a playfield (X by Y squares) that I plan on serialize and store in a BLOB in a MySQL (innodb) database, one row for each ongoing game. I now try to figure out a good way of keeping the database updated with any changes to the playfield, and at the same time finding a c...

Race conditions with setTimeout in a Firefox extension?

What happens when I call setTimeout in a firefox extension? Is there ever a condition in which multiple callbacks can run simultaneously? My firefox extension contains an array of URLs that I want to take screenshots of. My extension opens 5 tabs, and sets the URLs of these tabs to be the first 5 URLs in the array. Once a page finish...

Conditional wait with pthreads

I seem to be running in to a possible deadlock with a pthreads conditional variable. Here is the code thread function(){ for (condition){ do work /* should the thread continue? */ if (exit == 1){ break; /* exit for */ } } /* end for */ pthread_mutex_lock(&mtxExit); exit = 0; pthrea...

How do you avoid this race condition in Python / Django / MySQL?

I have a model MyModel that has a field expiration_datetime. Every time a user retrieves an instance of MyModel I need to first check if it has expired or not. If it has expired, than I need to increment some counter, update others, and then extend the expiration_datetime to some time in the future. So the view would do something ...

Why is `$@` untrustworthy?

I seem to recall that it is not safe to trust the value of $@ after an eval. Something about a signal handler having a chance to set $@ before you see it or something. I am also too tired and lazy right now to track down the real reason. So, why is it not safe to trust $@? ...

Using UML to detect potential race conditions in design

I'm battling a potential race condition in my application, which relies on multiple threads accessing a shared object to determine what their next logical operation should be. I certainly don't have a problem just scribbling stuff on a piece of paper or on the whiteboard, and using this to map out access to this shared object. However,...

Singlethreaded application shows race condition like behaviour

I have a big (~40mb) collection of XML data, split in many files which are not well formed, so i merge them, add a root node and load all the xml in a XmlDocument. Its basically a list of 3 different types which can be nested in a few different ways. This example should show most of the cases: <Root> <A> <A> <A></A> <A...

WebDAV & Exchange 2003 - works in debug, fails without

So I have a very weird problem. I am writing some code in VB.Net under .NET 2.0 which interfaces with MS Exchange 2003. Because of the Exchange 2003 "requirement" I am forced to write this code using WEBDAV. The code itself is replicating, to some degree, a schedule management process. It's creating Appointments on the Exchange Server...

Avoid Race Condition in Facebook JavaScript API with FB.logout

I am desperately trying to force a logout before a user starts a new facebook session. But before logout is succesfully called, auth.login seems to login the user and I redirect them. So it seems to be a race condition, but I can't figure out how to get around it. FB.init({appId: xxxx, status: true, cookie: true, xfbml: true}); //Tr...

Is there a possible race condition in this UPDATE statement?

I'm writing a synchronizer software which will take all changes in one DB and synchronize them to another DB. To this end I've added in my table T two columns: alter table T add LastUpdate rowversion, LastSync binary(8) not null default 0 Now I can easily select all rows that have changed since the last synchronization: select * from...