Problem Description
We are currently experiencing seeminly race condition issues, where sometime exactly 1 of all the /dev/shm/ecal_ files has the permission set to 644 instead of 666.
It typically happens when we run with sudo which default to have umask 0002.
We are using 6.0.1 eCAL. I have inspect the source code, for both 6.0.1 and latest main, I notice:
|
int previous_umask = umask(000); // set umask to nothing, so we can create files with all possible permission bits |
umask is being called in different parts of eCAL code. and there is actually blocking calls between
const int previous_umask = ::umask(000);
and
Wouldn't this create race condition where, for example we have two thread, thread1 and thread2:
thread1: ::umask(000);
thread2: ::umask(000);
thread1: ::umask(previous_umask);
thread2 ::shm_open(name.c_str(), O_RDWR | O_CREAT
thread2: ::umask(previous_umask);
the thread2 shm_open will have the wrong umask, not 000, but actually the process umask.
How to reproduce
Can't be sure.
But running pubisher in sudo privilege helps reproduction. And must be multiple topics streaming together.
How did you get eCAL?
I don't know
Environment
eCAL: 6.0.1
eCAL System Information
Problem Description
We are currently experiencing seeminly race condition issues, where sometime exactly 1 of all the /dev/shm/ecal_ files has the permission set to 644 instead of 666.
It typically happens when we run with sudo which default to have umask 0002.
We are using 6.0.1 eCAL. I have inspect the source code, for both 6.0.1 and latest main, I notice:
ecal/ecal/core/src/io/shm/linux/ecal_memfile_os.cpp
Line 46 in 966435b
umask is being called in different parts of eCAL code. and there is actually blocking calls between
and
Wouldn't this create race condition where, for example we have two thread, thread1 and thread2:
thread1: ::umask(000);
thread2: ::umask(000);
thread1: ::umask(previous_umask);
thread2 ::shm_open(name.c_str(), O_RDWR | O_CREAT
thread2: ::umask(previous_umask);
the thread2 shm_open will have the wrong umask, not 000, but actually the process umask.
How to reproduce
Can't be sure.
But running pubisher in sudo privilege helps reproduction. And must be multiple topics streaming together.
How did you get eCAL?
I don't know
Environment
eCAL: 6.0.1
eCAL System Information