Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR - Ticket 50459 - c_mutex to use pthread_mutex to allow ns sharing #3542

Closed
389-ds-bot opened this issue Sep 13, 2020 · 15 comments
Closed
Labels
merged Migration flag - PR pr Migration flag - PR

Comments

@389-ds-bot
Copy link

389-ds-bot commented Sep 13, 2020

Cloned from Pagure Pull-Request: https://pagure.io/389-ds-base/pull-request/50485


Bug Description: To allow nunc-stans to share the same lock as c_mutex
we need to change conn to use a pthread_mutex instead.

Fix Description: Change c_mutex to pthread

Resolves: #3517

Author: William Brown william@blackhats.net.au

Review by: ???

@389-ds-bot 389-ds-bot added merged Migration flag - PR pr Migration flag - PR labels Sep 13, 2020
@389-ds-bot
Copy link
Author

Comment from firstyear (@Firstyear) at 2019-07-08 07:46:29

Passes basic tests, I will load/stress test this tomorrow.

@389-ds-bot
Copy link
Author

Comment from mreynolds (@mreynolds389) at 2019-07-08 20:27:53

Could you add the "invalid state" to the log message?

@389-ds-bot
Copy link
Author

Comment from mreynolds (@mreynolds389) at 2019-07-08 20:29:45

Why did you remove the pdumutex condition test? While it's unlikely it would fail, it doesn't hurt to keep the check.

@389-ds-bot
Copy link
Author

Comment from mreynolds (@mreynolds389) at 2019-07-08 20:33:41

java-style comment...

@389-ds-bot
Copy link
Author

Comment from mreynolds (@mreynolds389) at 2019-07-08 20:40:54

Could you add the "invalid state" to the log message?

Never mind, I see there are only two possible states :-)

Anyway, some minor comments but the rest looks good, ack.

@389-ds-bot
Copy link
Author

Comment from tbordaz (@tbordaz) at 2019-07-09 11:58:00

Minor point. Do you mind to set c->c_state = CONN_STATE_INIT only after pthread_mutex_init call.

@389-ds-bot
Copy link
Author

Comment from firstyear (@Firstyear) at 2019-07-10 02:10:22

@mreynolds389 Thanks for the detailed check, I'll fix these up now.

I think you maybe misread the diff, I left the pdumutex check inplace? I just removed the "c_mutex || pdumutex" and changed it to "pdumutex" only?

@tbordaz CONN_STATE_INIT must be the first thing we set to indicate we have started to change the structure, meaning that after this point it could be in a partial init state, requiring free. But not that it even matters, this is C, so the compiler can and will re-arrange all of these assignments based on what's fast, up until we init/lock a mutex. So really, no matter how we arrange this, the compiler will find a way to surprise you ;)

I'll fix the comment and log message now :)

@389-ds-bot
Copy link
Author

Comment from firstyear (@Firstyear) at 2019-07-10 02:58:02

1 new commit added

  • Update based on mark and thierry review

@389-ds-bot
Copy link
Author

Comment from tbordaz (@tbordaz) at 2019-07-10 10:35:54

Sorry to be nit picker but I still have a concern.

Currently there is no real issue because the new connection handler is a single thread.
But with NS we can imagine parallel handler, that access the connection table in parallel. Correct ?
Is that part of code robust for parallel new connection handers ?
IMHO the ct->table_mutex should be acquired for the all functions.

Setting c_state=INIT before the real allocation of mutex means that an handler can return this connection while it is not yet fully initialized.

@389-ds-bot
Copy link
Author

Comment from firstyear (@Firstyear) at 2019-07-11 02:44:43

@tbordaz I think that's a concern for the NS ticket, not this one. This is just the change to pthread mutex, and I would like this merged as a single, simple unit of change. We can worry about the conntable management in the NS ticket which already has a number of these concurrency concerns. Is that reasonable for me to acknowledge your (very valid and thoughtful!) concern in the ns work ticket instead?

@389-ds-bot
Copy link
Author

389-ds-bot commented Sep 13, 2020

Comment from tbordaz (@tbordaz) at 2019-07-11 10:05:25

@Firstyear, you are right. This concern existed before your patch. The patch looks very good. ACK.

Regarding the concern, I preferred to open a separated ticket (#3546) as the NS ticket/PR (49569 / #2695#) is more focus on solving the double lock (c_mutex, job.monitor) deadlock than concurrent access to the connection table.

@389-ds-bot
Copy link
Author

Comment from firstyear (@Firstyear) at 2019-07-12 03:10:04

rebased onto d622686

@389-ds-bot
Copy link
Author

Comment from firstyear (@Firstyear) at 2019-07-12 03:10:43

Pull-Request has been merged by Firstyear

@389-ds-bot
Copy link
Author

Comment from firstyear (@Firstyear) at 2019-07-12 05:35:56

It looks like the addition of the c_state change is highlighting a potential connection allocation issue under NS, patch to come shortly ...

@389-ds-bot
Copy link
Author

Patch
50485.patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged Migration flag - PR pr Migration flag - PR
Projects
None yet
Development

No branches or pull requests

1 participant