Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Oct 22, 2021

the code as was before this PR, did not release the file-mutex on e.g. one of the Nette\IOException throwing cases

@staabm staabm changed the title ContainerLoader: make sure file-muted is released when exceptions are thrown ContainerLoader: make sure file-mutex is released when exceptions are thrown Oct 22, 2021
@milo
Copy link
Member

milo commented Oct 24, 2021

Some prove that the lock was not released?

@staabm
Copy link
Contributor Author

staabm commented Oct 24, 2021

You mean a unit test?

@dg
Copy link
Member

dg commented Oct 24, 2021

I think the flock($handle, LOCK_UN) is completely unnecessary in the current code and thus your modification has no effect.

@staabm
Copy link
Contributor Author

staabm commented Oct 24, 2021

So the idea is: it is useless because the handle is stored in a local variable which frees the handle and the lock when the variable is going out of scope?

@dg
Copy link
Member

dg commented Oct 24, 2021

Yeah, exactly.

@staabm staabm changed the title ContainerLoader: make sure file-mutex is released when exceptions are thrown ContainerLoader: simplify mutex handling Oct 26, 2021
@staabm
Copy link
Contributor Author

staabm commented Oct 26, 2021

as discussed, I adjusted the PR to remove the UNLOCK line (and added a comment).

@dg
Copy link
Member

dg commented Oct 26, 2021

Thanks

@dg dg merged commit 6c57b33 into nette:master Oct 26, 2021
@staabm staabm deleted the patch-1 branch October 26, 2021 09:03
dg added a commit that referenced this pull request Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants