php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69101 Calling registered method with less than required num args hangs client side
Submitted: 2015-02-22 08:59 UTC Modified: -
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: spinkus at epicmorsel dot com Assigned:
Status: Open Package: DBus (PECL)
PHP Version: 5.4.38 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: spinkus at epicmorsel dot com
New email:
PHP Version: OS:

 

 [2015-02-22 08:59 UTC] spinkus at epicmorsel dot com
Description:
------------
Client hangs while server gets an exception. It does not hand indefinitely though - think its 30s. The issue is related to the code not generating a dbus error messsage response on error, but rather just aborting on server side by throwing an error when the function call fails. Tracing the issue:

  PHP_METHOD(Dbus, waitLoop)
    ...
    php_dbus_accept_incoming_method_call(dbus, msg, &return_value TSRMLS_CC);
      ...
      php_dbus_do_method_call(dbus, msg, class, member TSRMLS_CC);
        ...
        call_user_function_ex(EG(function_table), &object, callback, &retval_ptr, num_elems, method_args, 0, NULL TSRMLS_CC) == SUCCESS) {

Need to change error handling around call_user_function_ex() and respond with an error message. I tried but failed.

Test script:
---------------
Server:
  <?php
  $d = new Dbus(Dbus::BUS_SESSION, true);
  $d->requestName('nl.derickrethans.test');
  $d->registerObject('/nl/derickrethans/test', 'nl.derickrethans.test', 'testClass');

  class testClass {
    static function echoOne($a) {
      return $a;
    }
  }

  while (true) {
    try {
      $s = $d->waitLoop(1000);
      echo "Woke up.\n";
    } catch(Exception $e) {
      echo "Exception:" . get_class($e) . " " . $e->getMessage() . "\n";
    }
  }

  ?>

Client:
  <?php
  $dbus = new Dbus( Dbus::BUS_SESSION, true );
  $o = $dbus->createProxy('nl.derickrethans.test', '/nl/derickrethans/test', 'nl.derickrethans.test');
  var_dump($o);

  while(1) {
    print "Loop Start\n";
    //Hangs
    try {
      echo "Calling echoOne() not enough args\n";
      $retval = $o->echoOne();
      echo "Got reply: $retval\n";
    } catch(Exception $e) {
      echo "Exception:" . get_class($e) . " " . $e->getMessage() . "\n";
    }
    sleep(1);
  }
  ?>

Expected result:
----------------
Client throws an exception straight away.

Actual result:
--------------
Client hangs for ~30 seconds then throws a "NoReply" exception.

Patches

Pull Requests

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 05:01:30 2024 UTC