piston-lib problem

in piston-lib •  8 years ago 

My script keeps crashing (randomly).

I'm running two instances of it, at the same time, connected to different nodes.
( the standard node and node="wss://gtg.steem.house:8090" )
It works fine for a while, but after some time it crashes like this (simultaneously for both scripts):

Traceback (most recent call last):
  File "/home/felixxx/.local/lib/python3.5/site-packages/piston_lib-0.5.2-py3.5.egg/pistonapi/steemnoderpc.py", line 124, in 
rpcexec
  File "/home/felixxx/.local/lib/python3.5/site-packages/graphenelib-0.5.0-py3.5.egg/grapheneapi/graphenewsrpc.py", line 
160, in rpcexec
grapheneapi.graphenewsrpc.RPCError: 13 
N5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEEE: unable to acquire lock
unable to acquire lock: 
    {"call.method":"call","call.params":[0,"get_ops_in_block",[10956212,false]],"what":"unable to acquire lock"}
    th_a  websocket_api.cpp:124 on_message

This is quite annoying.

Is this problem on the server side (nodes) or can I fix my script ?

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

I used to have a similar problem with acquire lock error, I think that the issue is from having only one instance of

steem = Steem(node='wss://node.steem.ws', wif=posting_key[0])

further up in your code and the connection timing out. If you are waiting 20 or so minutes before upvoting it's better to create another a fresh call to

worker_steem = Steem(node='wss://node.steem.ws', wif=posting_key[k])

within the worker thread. See Winfreybot by @fyrstikken

HTH

Also if you know how to detect and prevent an upvote when a post has declined payout that would help me out :)

Thanks for the answer.

I'm not waiting for any time with the upvote.
This crash occurs within the

for operation in chain.ops():

loop.
Not when I try a transaction.

I don't know where to find the 'declined payout' option, but will look into it later.

Check for declined payout:

if c['reward_weight'] == 0:

while 'c' is the post.

Hi @felixxx I'm not sure it's the right parameter, it returns 10000 for me whether pay is declined or not :S maybe I am calling it wrong?

This works ( it's dirty )

from piston.amount import Amount

if str(Amount(c['max_accepted_payout']))  == '0.000 SBD':

Awesome thanks, will give it a try later

I didn't test it, sorry.

Maybe its 'max_accepted_payout' ...
If not, I don't know either.
'reward_weight' looked good :D - sorry

Thanks will try it out later, hope you get to the bottom of your problem!