2,467 questions
0
votes
0
answers
36
views
Why does macOS MultitouchSupport framework crash if MTDeviceStop is called immediately after MTUnregisterContactFrameCallback?
I'm using Apple's private MultitouchSupport.framework to receive raw trackpad touch data on macOS. The basic pattern is:
MTDeviceCreateList() / MTDeviceCreateDefault() to get device references
...
5
votes
2
answers
151
views
How to prevent race condition in AWS DynamoDB and Lambda
I have a pipeline where:
Lambda A reads DynamoDB and publishes events to Kinesis
Kinesis partitions events by key
Lambda B consumes the stream and writes the latest record per key back to DynamoDB
...
1
vote
1
answer
69
views
Oracle MERGE causes DuplicateKeyException under high concurrency with composite primary key
I’m running into a race condition when using an Oracle MERGE statement from a Spring Boot application, and I’m trying to understand why this happens and what the correct way to handle it is.
When ...
Advice
0
votes
2
replies
113
views
Is there a race condition in GCC's implementation of std::call_once?
The main lines of GCC's implementation of std::call_once are these ones (with _GLIBCXX_HAS_GTHREADS):
'libstdc++-v3/include/std/mutex:939'
enum _Bits : int { _Init = 0, _Active = 1, _Done = 2 };
'...
0
votes
0
answers
92
views
How to run Next.js and Jest concurrently, with an instance of Next.js already running?
I have this script in my Next.js project, where I start a Next.js server (because the tests need it) and run Jest tests using concurrently:
"test": "npm run services:up &&
...
1
vote
1
answer
97
views
How to avoid checkout payment race conditions with limited stock? Rails 8
I am building an e-commerce with Rails 8 and Stripe through their API for a pottery business. These are all unique, one-off items for now and with the demand she already has, I anticipate her site ...
3
votes
1
answer
86
views
Is it possible in Java for a task scheduled with scheduleAtFixedRate to start executing before the returned ScheduledFuture has been assigned?
In Java, when using scheduleAtFixedRate, is it possible for a task to execute before the ScheduledFuture returned by scheduleAtFixedRate has been assigned?
For example, could the following code throw ...
1
vote
0
answers
57
views
gem5 Cache Prefetcher Assertion Failure in sendMSHRQueuePacket: Prefetch Request Sent for an Existing Cache Line
I'm currently using gem5-dpdk (GitHub) with the following cache hierarchy setup:
Using ARM version(O3 cpu), full system mode
Simulating DPDK network application (e.g., MACSWAP)
L1 Cache: no ...
4
votes
1
answer
140
views
Why does my CPU usage calculation from /proc/stat jump between 0% and 100% when called from both main and a worker thread?
I’m trying to monitor CPU usage on Linux by reading /proc/stat. I'm stressing the CPU to get 100%.
I use a function getCpuUsage() based on comparing consecutive /proc/stat readings.
The return value ...
Advice
0
votes
4
replies
147
views
Using lockless atomic operations instead of a mutex
I recently had an interview where I was asked to show how to prevent race conditions in C or C++ between two threads operating on shared data. I used a mutex as follows :
pthread_mutex_t mutex;
int ...
5
votes
0
answers
232
views
Why does this data race have some consistent invariants with writers updating one of three atomic<int> variables?
I have the following program. The relevant info is:
There are 3 variables atomic<int> x,y,z accessed by all threads.
3 writer threads: Each thread read all 3 values x,y,z, and update exactly 1 ...
0
votes
1
answer
94
views
Will file logging race conditions in multi-process Flask app crash the Python script?
I have a Flask application running on Gunicorn with 2 workers and 2 threads each (4 concurrent execution contexts). My custom logging function writes to a file without any process-level locking:
def ...
3
votes
2
answers
166
views
c++ mutex with different data in the critical section
class MyTest {
void getter() {
std::unique_lock lock(mutex_);
if (!set_) {
cout << "set already" << endl;
}
lock.unlock();
// question ...
4
votes
1
answer
159
views
c++ mutex and memory barrier
class MyTest {
void getter() {
std::unique_lock lock(mutex);
if (!set_) {
cout << "set already" << endl;
...
3
votes
0
answers
86
views
Avoiding race conditions for time-range inserts in MongoDB
I have a scheduling system on MongoDB using Node.js + Mongoose.
Collections: Drivers, Vehicles, Trips.
I need to insert a new Trip for a given driverId, date, startTime, endTime only if that driver ...