-
Notifications
You must be signed in to change notification settings - Fork 10
Fix wrong initial semaphore state #4
base: master
Are you sure you want to change the base?
Conversation
If O_CREAT is specified, and a semaphore with the given name already exists, then mode and value are ignored. The value should be set to 1 in over case.
@ihuerner please review. |
@jeremiah We faced with this issue (rare occurence) on our project and think it's critical because if it is happened it may affect the whole functionality of persistence because it is the common component. In our case persistence administrator was not able to install the database. |
l don't get the problem. |
@ihuerner Actually we had a case when semaphore does not exist, and in this case it was created with value 0 and then it was stuck on sem wait and failed due to timeout. |
@@ -258,7 +258,7 @@ sint_t pers_lldb_open(str_t const* dbPathname, pers_lldb_purpose_e ePurpose, boo | |||
DLT_LOG(persComLldbDLTCtx, DLT_LOG_INFO, | |||
DLT_STRING(LT_HDR); DLT_STRING(__FUNCTION__); DLT_STRING(": semaphore already exists: "); DLT_STRING(strerror(error))); | |||
//try to open existing semaphore | |||
pLldbHandler->kissDb.kdbSem = sem_open(pLldbHandler->kissDb.semName, O_CREAT, 0644, 0); | |||
pLldbHandler->kissDb.kdbSem = sem_open(pLldbHandler->kissDb.semName, O_CREAT, 0644, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Despite of comment above (try to open existing semaphore), sometimes the semaphore does not exist when set_open is called, in this case it will be created with incorrect 0 value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the tests are still running successfully, I think we can accecpt the suggested modification.
Did you run the tests?
@mdanilov Did you run the tests? |
@martin-ejdestig Have you run into this issue at all? What do you think, should this change be made? |
Not yet. We (PELUX team) are basically trying to get persistence-storage working at all so that we can evaluate it.
I do not know. But... is the problem perhaps that there is a race condition here? It was a while since I used POSIX semaphores but if the semaphore exists when the first So... I guess it is correct to have a 1 in the second But then... if that is correct... why is this just not a single |
If O_CREAT is specified, and a semaphore with the given name already exists, then mode and value are ignored. The value should be set to 1 in over case.