Questions tagged [race-condition]

A race condition is when multiple threads/processes/clients all use a resource, without proper use of locks.

0
votes
1answer
30 views

Concurrent inserts and race condition in MySQL

I have a case, where I should limit rows per user in the table. Now I am doing this via COUNT * FROM table check before insert, and if the count equals/more than allowed, I throw an error. COUNT and ...
1
vote
0answers
10 views

How to maintain a postgreSQL lock from a trigger “before update” through the update operation itself

I apologize if this is an answered question, I did some research, and I couldn't find an answer.I'm maintaining a folder/file like structure in my code where I have ordered items that cascade order ...
0
votes
0answers
33 views

OpenMP: Race condition within single region between barriers

Consider the following code extract, part of a larger code:201 for (int iMesh=_meshByThread[iThread][0]; iMesh <=_meshByThread[iThread][1]; iMesh++){202 _eq[iMesh]->...
0
votes
2answers
65 views

Race Condition with writing same value in C++?

Is there any issue with having a race condition in your code when the operation is writing a single constant value? For example if there is a parallel loop that populated a seen array for every value ...
1
vote
1answer
40 views

How does a database sequence manages a race condition?

I am writing an application which will be deployed on n number of nodes. The applications entity classes used the SEQUENCE generation strategy to generate the primary keys. Since, there would be bulk ...
0
votes
2answers
42 views

Move files with Apache Camel to different directories depending on how many files are found

A process should output one and only one file, it things go wrong it could result in zero or a few files in the output directory.I want to pick up the file(s) and move them to directory A if there ...
-1
votes
0answers
29 views

How to avoid race condition while multiple consumers attached to the queue?

As shown below, we are publishing all the leads generated across platforms to a common RabbitMQ queue. There are multiple consumers attached to the queue to process leads.Leads are routed to ...
0
votes
1answer
28 views

How to detect missing tick() in fakeAsync()

I wrote this test for my Angular app:it('should request confirmation before deleting & abort action if user declined', fakeAsync(()=> {spyOn(appService, 'confirm').and.returnValue(of(...
1
vote
1answer
16 views

Trying to run fetch function before register a service worker.

I am trying to run a fetch function which will get me some values from my server. But for some reason the registration of a service worker fires first and its leaving "app_key" undefined causing it to ...
-2
votes
1answer
70 views

Enforcement of memory write before execution of later code

I am writing code that triggers a DMA. Once the DMA has completed its operation it will call ISR_Routine. The problem is that I want to ensure that the refreshComplete is set to 0 before the DMA runs. ...
-2
votes
2answers
91 views

Race-condition as a random number generator

I simulated a race-condition between threads in C++ by "pthread.h"when running it, it gots error at a "random" loop iteration.Can I use it as a random number generator?And why?#include<cstdio&...
0
votes
0answers
75 views

“thread blocked indefinitely in an STM transaction” in a case where threads are never blocked

I'm using the async library in conjunction with stm in my program.The main thread forks two threads which run until one of them (it could be either one) encounters a solution. The solution is ...
0
votes
1answer
43 views

Mutex used right?

I'm a bit confused about mutex locken/unlocking more times after another.I'm using a RWMutex and all goroutines will have the same mutex of course.Is this code still race-protected when using ...
0
votes
1answer
50 views

T-SQL stored procedure with dateadd fails

Seemingly simple part of my stored procedure appears to be failing, a date comparison. I am looking for the oldest order that is more than 5 minutes old to begin processing it.The stored procedure ...
0
votes
0answers
18 views

Simultaneous inserts with historical dependency

I have a table where I insert "transactions" via a stored procedure. Whenever a "transaction" is inserted, a trigger on this table will insert a "fundUpdate" in the "fundUpdate" table. Inserting a "...
0
votes
0answers
18 views

Get whether a blocking lock blocked

In Python 3, I want to acquire a lock and then know whether it blocked or not. The problem is that threading.Lock.acquire always returns True if it is called with blocking=True, so there is no way to ...
0
votes
0answers
27 views

Multithreaded program hangs on control method call

I've got a UI with 2 buttons and a textbox.When the user presses the "Receive" button, a thread is started for an infinite work loop (receiving and printing messages from multicast). When the user ...
2
votes
2answers
81 views

How to to avoid race conditions on the UI thread when using async/await [duplicate]

We have all heard that it's important to keep the UI thread responsive, so we implement async/await everwhere.I'm building a text editor, where 'everything' is asynchron. However, now I find that its ...
2
votes
2answers
43 views

Python: Very strange behavior with multiprocessing; later code causes “retroactive” slowdown of earlier code

I'm trying to learn how to implement multiprocessing for computing Monte Carlo simulations. I reproduced the code from this simple tutorial where the aim is to compute an integral. I also compare it ...
0
votes
1answer
35 views

How to understand the member testing and adding race condition of NSMutableSet?

When I reading the book 《Objective-C 2.0 Phrasebook》, There is something about NSMutableSet that I don't really understand, as follow,There is a potential race between testing whether the string ...
0
votes
2answers
41 views

On Page Load Offset Value set to 0. On Inspection value is calculated

The goal is to use a url fragid to jump to a particular section on a separate page on page load. <a href="http://stackoverflow.com.mevn.net/page.php#section>The unexpected behavior is that on page load the offsetTop does not ...
0
votes
1answer
24 views

How to stop the same data into database when the network is so slow

I use following code to accept the regsiter call from client.post('/regsiter', async (ctx)=> {requestfrom=JSON.parse(JSON.stringify(ctx.request.body))let regxemail=/^[a-z0-9]+([._\\-]*[...
1
vote
1answer
31 views

Django: Maintaining a counter in a field (race condition)

I have a model similar to this exampleclass Foo(models.Model):a=models.ForeignKey(...)number=models.IntegerField()@transaction.atomicdef save(self, commit=True):if ...
0
votes
0answers
37 views

HttpClient.SendAsync().ContinueWith() Task dies before finishing

I am writing a ASP.NET MVC app and have a method calling out to a web service.protected Task ExecuteRequest(HttpClient client, HttpRequestMessage restRequest){SynchronizationContext....
1
vote
1answer
34 views

How to prevent any routing before some async data (in Vuex store) has loaded?

In my application I need some data to be loaded inside the VueX store before routing starts (for example user sessions).An example of a race condition would be the following:// In routes ...
1
vote
1answer
78 views

Why does newer glibc implement posix_spawn with vfork instead of fork?

I am tracing posix_spawn source code in glibc 2.17 and glibc 2.27.(glibc 2.17: sysdeps/posix/spawni.c)(glibc 2.27: sysdeps/unix/sysv/linux/spawni.c)I found glibc 2.17 uses vfork or fork ...
1
vote
0answers
50 views

Is there a way to stop the AURemoteIO thread from the AutioToolBox from performing its polling tasks?

So I am using cocos2dx new AudioEngine, and I am having this crash: https://github.com/cocos2d/cocos2d-x/issues/18948.0 0x0000000184a5cea8 in CrashIfClientProvidedBogusAudioBufferList ()1 ...
1
vote
1answer
43 views

Race condition in httptestserver when changing handler

I have a slice of tests and I want to run them over one instance of httptest.Server. Each test has its own handler function.func TestAPICaller_RunApiMethod(t *testing.T) {server :=httptest....
1
vote
1answer
54 views

Spawned function to wait for the spawning transaction to be committed?

I have a query making a few changes to the database (changing some collections on a couple of documents), then spawning a function.The spawned function does not see the changes made in the spawning ...
0
votes
3answers
36 views

In which situations it's needed to use volatile keyword with Atomic field?

In which situations it's needed to use volatile keyword with Atomic field? Or if the field is Atomic*** keyword volatile is redundant?Thank you
-1
votes
1answer
42 views

Best way to solve race condition on DataBase

I have an application that saves captions for a movie.I need to prevent a scenario where 2 captions are overlapping.First I will define what is overlapping captions.Let's assume that caption class ...
0
votes
1answer
83 views

Running into a race-condition, even with a 'wait'

I'm facing a strange race condition in my bash program. I tried duplicating it via a simple enough demo program but, obviously, as true for all/most timing-related race demonstration attempts, I ...
0
votes
0answers
18 views

How to avoid race condition between `addEventListener` and `window.open`

As part of the OAuth flow for my site, I'm using window.open to allow the user to sign in to the 3rd party provider, and postMessage to send the auth token back to my webpage. The basic flow looks ...
0
votes
1answer
51 views

Camel file reading: race condition with 2 active servers

In our ESB project, we have a lot of routes reading files with file2 or ftp protocol for further processing. Important to notice, that the files we read locally (file2 protocol) are mounted network ...
0
votes
1answer
85 views

How to find duplicated Ruby methods with the same name but different code?

The very large Ruby codebase I am working with has many instances of duplicated methods defined with the same name but some of its code is different (causing a large race condition problem). The ...
0
votes
1answer
54 views

Race condition in unit tests

I'm currently testing a number of classes that do network stuff like REST API calls, and a Realm database is mutated in the process. When I run all the different tests I have at once, race conditions ...
2
votes
1answer
36 views

Race Conditions in MySQL multi statement query with user defined variables?

Here is multi query running from Node.jsSET @var=123;INSERT INTO `table` VALUES ('test', @var)ON DUPLICATE KEY UPDATE column=@var :=IF(column < @var, @var, column + @var);SELECT @...
0
votes
0answers
33 views

How to avoid race condition in Django when assigning an integer field a value, based on a value belonging to the VERY LAST similar object in the db?

Some example code showing the issue:class Post(models.Model):...class Comment(models.Model):...post=models.ForeignKey(Post, related_name='comments',on_delete=...
-1
votes
1answer
149 views

race condition in java

public class LongWrapper {private long l;public LongWrapper(long l){this.l=l;}public long getL() {return l;}public void setL(long l) {this....
-2
votes
1answer
13 views

How to Quantify the Race Condition. Suppose I have 20 threads in a program and 10 times the race condition has came

How to Quantify the Race Condition. Suppose I have 20 threads in a program and 10 times the race condition has came.Supoose I want to make a general formula for the same what it may be.
0
votes
3answers
38 views

Cucumber test for AJAX call testing data has been saved

I have a web page which makes an AJAX call to update data in the database. I want to write a cucumber test to enter the data on the page, triggering the AJAX call, and then verify that the data was ...
0
votes
1answer
45 views

Can't make race condition, is my code running sequentially?

I'm trying to demo a race condition in Python with following code but always get expected value 0. Is there something wrong with my code just it's just not "intensive" enough to trigger the race ...
1
vote
1answer
57 views

does fs.writeFile() handles race condition in nodejs?

Before question, I hope u have basic knowledge on aws-sqs (not quite required though).Does fs.writeFile() handle race condition within itself ? I have come across an implementation like , ...
0
votes
0answers
43 views

C++: Modify same pointer using multiple threads

I am attempting an experiment with processing images in which I am modifying the color in each pixel. I tried implementing my code using "buckets", in which I divide the image into smaller regions - ...
0
votes
0answers
35 views

race condition with boost::barrier

I am using boost bariers and I have n-threads, the main thread plus (n-1) worker threads. This is all in the following class.I have marked a few lines of code with the comment IS_SAFE?. Are these ...
1
vote
2answers
42 views

Why am I getting a race condition in multi-threading scala?

I am trying to parallelise a p-norm calculation over an array. To achieve that I try the following, I understand I can solve this differently but I am interested in understanding where the race ...
0
votes
1answer
23 views

Method checks for lock, runs after lock released

Im facing a potential chase error. Im using javafx TableView to display my data, and I'm periodically receiving an update request externally which calls my update function. I also have some listeners ...
0
votes
1answer
35 views

openmp lock reacquired by the same thread while other thread is waiting for it

I'm using an inverted lock as a semaphore to signal a queue update (notice the commented out Sleep(1), it will be used later):#include <stdio.h>#include <omp.h>#include <queue>#...
1
vote
0answers
37 views

Unblocking all processes waiting on a semaphore

I have a program that requires several processes access a shared resource. This shared resource does not exist when they all start, so one of them needs to create it. Once the shared resource is ...
0
votes
1answer
99 views

How may I lock an element of a ConcurrentDictionary?

I have a ConcurrentDictionary stoing Items:ConcurrentDictionary<ulong, Item> items;Now I would like to lock on an Item from this dictionary so I may safely operate on it.Is this code ...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,