Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Cache] sem_remove() warning is thrown when concurrent requests are processed  #44030

Closed
@TwanVermeulen

Description

@TwanVermeulen

Symfony version(s) affected

v5.4.0-BETA1

Description

In some cases the lock component fails to acquire a semaphore. In this scenario it will try to remove a non existent semaphore, which results in a PHP warning:

sem_remove(): SysV semaphore [id] does not (any longer) exist.

This seems to be related to the recent change in 5.4 to use semaphores instead of flock in the LockRegistry

How to reproduce

PHP Version: 7.4

On my machine the acquiring failure can be reproduced in this scenario:

Have two concurrent processes: Process A and Process B

  1. Process A wins the lock race and acquires a semaphore
  2. Process B will not acquire a lock, but will wait until the semaphore becomes available again (acquire in blocking mode)
  3. Process A will remove the the semaphore at the end of the request.
  4. Process B will continue, but the acquiring fails since the semaphore is removed in Process A
  5. Process B will try to remove the semaphore, but since it does not exist this results in the PHP warning

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions