Skip to content

[Lock] Fix/lock test #23847

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

Merged
merged 1 commit into from
Aug 10, 2017
Merged

[Lock] Fix/lock test #23847

merged 1 commit into from
Aug 10, 2017

Conversation

jderusse
Copy link
Member

@jderusse jderusse commented Aug 9, 2017

Q A
Branch? 3.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets N/A
License MIT
Doc PR N/A

Test on the Lock component often fail, the purpose of this PR is to fix it.

The goal of this failling test is to assert that blocking locks works. To test the blocking mode, I had to create 2 concurent process and I used pcntl_fork for that.
Sadly, travis takes more time to fork the process than configured TTL.

This PR replace the previous "sleep" to let child and parent starts, by a pcntl communication between child and parent.

Process 1 Process 2
Wait N°2
Acquire Lock
Send signal to N°1
Wake up Wait N°1
Try lock(non block)
=> assert failure
Send signal to N°2
lock(block) Wake up
.. sleep 50 000ms
.. ..
.. Release lock
=> assert Acquired exit
Release lock
=> assert child exit 0

@jderusse jderusse force-pushed the fix/lock-test branch 3 times, most recently from 2e8ac63 to 919a1c0 Compare August 10, 2017 05:19
@fabpot
Copy link
Member

fabpot commented Aug 10, 2017

Thank you @jderusse.

@fabpot fabpot merged commit ff95169 into symfony:3.4 Aug 10, 2017
fabpot added a commit that referenced this pull request Aug 10, 2017
This PR was merged into the 3.4 branch.

Discussion
----------

[Lock] Fix/lock test

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

Test on the Lock component often fail, the purpose of this PR is to fix it.

The goal of this failling test is to assert that blocking locks works. To test the blocking mode, I had to create 2 concurent process and I used pcntl_fork for that.
Sadly, travis takes more time to fork the process than configured TTL.

This PR replace the previous "sleep" to let child and parent starts, by a pcntl communication between child and parent.

| Process 1               | Process 2
| ----------------------- | ----------
| Wait N°2                |
|                         | Acquire Lock
|                         | Send signal to N°1
| Wake up                 | Wait N°1
| Try lock(non block)     |
|  => assert failure      |
| Send signal to N°2      |
| lock(block)             | Wake up
| ..                      | sleep 50 000ms
| ..                      | ..
| ..                      | Release lock
|  => assert Acquired     | exit
| Release lock            |
|  => assert child exit 0 |

Commits
-------

ff95169 Fix lock failling test
@jderusse jderusse deleted the fix/lock-test branch August 2, 2019 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants