Conversation
|
This does update the timeout upon use; which is a behavior change. This could instead be an option on the SSL_CTX to which it has been added (so, new API) |
|
typo in commit heading message and PR Title ;) |
|
Added unit tests |
|
Rebase, fix comment, fix CI (I hope) |
|
Travis failure seems to be a build timeout? |
|
Added option to update the time upon add. |
ssl/ssl_sess.c
Outdated
There was a problem hiding this comment.
I know this is inviting controversy to propose, but we may want to assert (in some form) that next != NULL after this line.
There was a problem hiding this comment.
See above as to what the proposed assert should check.
|
Thanks @paulidale, we actually backed this out of our repo because it caused a problem... or exposed a problem... we're not exactly sure, but we had some weird behavior with this. |
|
Should this be closed then? |
|
No, we need to test it more. If you see anything obvious; great. But I think it exposed a problem we had, and we actually need to clean up the other code (which is PR #3761). |
|
This exposed a problem in some of our other changes @paulidale, so it's actually good. |
ca21130 to
394a332
Compare
|
This PR is in a state where it requires action by @openssl/committers but the last update was 30 days ago |
|
This PR is in a state where it requires action by @openssl/committers but the last update was 61 days ago |
|
This PR is in a state where it requires action by @openssl/committers but the last update was 92 days ago |
394a332 to
3d630a9
Compare
|
This PR is in a state where it requires action by @openssl/committers but the last update was 123 days ago |
|
This PR is in a state where it requires action by @openssl/committers but the last update was 154 days ago |
|
This PR is in a state where it requires action by @openssl/committers but the last update was 185 days ago |
|
ping @mattcaswell ? |
|
Ping @openssl : this PR is failing in the limbo. |
ssl/ssl_sess.c
Outdated
There was a problem hiding this comment.
This reads s->time with no lock, and then subsequently writes to it under a write lock. Shouldn't there be a read lock here?
There was a problem hiding this comment.
Not necessarily. It's checking to see if it's different; the actual value doesn't matter. This is an optimization to see if it should be updated. Previously it would just slam the time into the session without any locking at all. Any manipulation is done under lock. But note that the lock only happens if the session is in a SSL_CTX cache; the SSL_SESSION structure does not have a lock.
There was a problem hiding this comment.
But if s->owner is non-NULL then we know that the session has already been placed in the cache and therefore taking a read lock might be appropriate. It definitely seems odd to control writes with a write lock, but not reads.
There was a problem hiding this comment.
I would agree 100% if the value read were used for something meaningful. In this case, it's really not. It's read to see if there needs to be a change. If so, do the update; the prior value doesn't matter.
Because of that, locking for read here is pointless; if we're always going to lock, then we might as well always update, and remove the (albeit minor) optimization. I can make that change (unless my argument is convincing 😄 ).
There was a problem hiding this comment.
I would prefer to see it modified as you suggest.
ssl/ssl_sess.c
Outdated
There was a problem hiding this comment.
Reads s->timeout not under lock, and then subsequently writes to it under lock. This seems wrong.
|
@mattcaswell lots (most?) of the code was originally written w/o read locks; this doesn't really change that. |
Sort SSL_SESSION structures by timeout in the linked list. Iterate over the linked list for timeout, stopping when no more session can be flushed. Do SSL_SESSION_free() outside of SSL_CTX lock Update timeout upon use
I'm satisfied with most of the answers - although I've left 2 comments unresolved which I'm still not convinced about. |
|
@mattcaswell I think I made the requested changes. |
|
@paulidale - please can you reconfirm your earlier approval? |
|
This pull request is ready to merge |
|
Merged, thanks for this. |
Sort SSL_SESSION structures by timeout in the linked list. Iterate over the linked list for timeout, stopping when no more session can be flushed. Do SSL_SESSION_free() outside of SSL_CTX lock Update timeout upon use Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Paul Dale <[email protected]> (Merged from #8687)
Sort SSL_SESSION structures by timeout in the linked list. Iterate over the linked list for timeout, stopping when no more session can be flushed. Do SSL_SESSION_free() outside of SSL_CTX lock Update timeout upon use Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Paul Dale <[email protected]> (Merged from openssl#8687)
Sort SSL_SESSION structures by timeout in the linked list.
Iterate over the linked list for timeout, stopping when no more
session can be flushed.
Do SSL_SESSION_free() outside of SSL_CTX lock
Update timeout upon use
Checklist