zhouaini528 / binance-php

Binance API Like the official document interface, Support for arbitrary extension.
MIT License
107 stars 43 forks source link

TypeError: method_exists() #50

Open blackcatt opened 1 year ago

blackcatt commented 1 year ago

When working with binance futures sometime I have trouble in workerman.log like this:

TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given in .../vendor/linwj/ Stack trace:

0 /var/www/.../vendor/linwj/binance/src/Request.php(144): method_exists()

1 /var/www/.../vendor/linwj/binance/src/Api/Futures/Trade.php(52): Lin\Binance\Request->exec()

2 /var/www/....php(770): Lin\Binance\Api\Futures\Trade->postOrder()

...

4 /var/www/....php(385): account_update()

5 /var/www/.../vendor/workerman/workerman/Connection/TcpConnection.php(646): {closure}()

6 /var/www/.../vendor/workerman/workerman/Events/Select.php(311): Workerman\Connection\TcpConnection->baseRead()

7 /var/www/.../vendor/workerman/workerman/Worker.php(1629): Workerman\Events\Select->loop()

8 /var/www/.../vendor/workerman/workerman/Worker.php(1423): Workerman\Worker::forkOneWorkerForLinux()

9 /var/www/.../vendor/workerman/workerman/Worker.php(1397): Workerman\Worker::forkWorkersForLinux()

10 /var/www/.../vendor/workerman/workerman/Worker.php(560): Workerman\Worker::forkWorkers()

11 /var/www/....php(1305): Workerman\Worker::runAll()

12 {main}

exit with status 64000

So, the Worker restarted, and this is not good and incomprehensible. My postOrder() code is wrapped to try/catch but anyway error happened (very rare, but it exists) Also I saw this problem when calling methods putListenKey() deleteOrder() deleteBatchOrders() getTickerPrice() Even if problem in network connection there should be a solution to catch this error

Please help to solve this issue.

zhouaini528 commented 1 year ago

I have already solved it, you can try again.