php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50378 msg_receive() blocks next requests to the same URL
Submitted: 2009-12-03 23:55 UTC Modified: 2009-12-07 19:14 UTC
From: dimitri dot ho at gmail dot com Assigned:
Status: Not a bug Package: Semaphore related
PHP Version: 5.2.11 OS: Linux
Private report: No CVE-ID: None
 [2009-12-03 23:55 UTC] dimitri dot ho at gmail dot com
Description:
------------
msg_receive() blocks next requests to the same URL

Reproduce code:
---------------
<?php

file_put_contents("/tmp/" . uniqid('moo') . '.txt', __FILE__);

$queue = msg_get_queue(123456);
msg_receive($queue, 1, $msgType, 1024, $var);

Expected result:
----------------
When running it twice, I expect to see 2 /tmp/moo* files.

Actual result:
--------------
Let's say my URL is http://quux.fr/receive.php.

Run http://quux.fr/receive.php once: a moo file is created.

Run it a second time: no file is created.

Run http://quux.fr/receive.php?lol: a new moo file is created.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-04 04:42 UTC] jani@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2009-12-04 07:16 UTC] dimitri dot ho at gmail dot com
Actually, the script was complete and worked. :)

<?php

file_put_contents("/tmp/" . uniqid('moo') . '.txt', __FILE__);

$queue = msg_get_queue(123456);
msg_receive($queue, 1, $msgType, 1024, $var);

?>
 [2009-12-04 08:20 UTC] jani@php.net
Exactly, it works like you want so what's the bug here?
 [2009-12-04 08:49 UTC] dimitri dot ho at gmail dot com
I meant the script can reproduce the bug, and was not incomplete. It doesn't work as I expected.
 [2009-12-07 18:51 UTC] jani@php.net
Well, it works fine. Quite likely the issue has nothing to do with semaphores.
 [2009-12-07 19:14 UTC] dimitri dot ho at gmail dot com
I forgot a detail. When requesting the second time, you must open it in a new window or tab. The first request must be blocked (which is an expected behavior) while you make the second request with the same URL (which should create another file then block, but it just blocks).
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Sep 29 02:03:37 2021 UTC