pycardano icon indicating copy to clipboard operation
pycardano copied to clipboard

TransactionFailedException with empty websocket response / receiving empty string

Open ross-spencer opened this issue 1 year ago • 0 comments

Describe the bug A clear and concise description of what the bug is.

Result in the section of code below might not be an error, rather an empty string:

  • https://github.com/Python-Cardano/pycardano/blob/54ec756c093cd832c43cf85a5cd0f3f7ce651b7a/pycardano/backend/ogmios.py#L106-L109

TransactionFailedException might be an appropriate response, but the formatting for the error string looks like it's masking something else.

Suggest some way of delineating the message, e.g. using single quotes around the f-string expression? e.g. f"some response: {response}`".

Though maybe there's a better way of handling an empty response from .recv()?

To Reproduce Steps to reproduce the behavior. e.g. A python script.

I can't reliably recreate this yet, I am seeing it in a long-running process making a lot of requests to Ogmios 5.x.

Logs If applicable, add logs to help explain your problem.

Expected behavior A clear and concise description of what you expected to happen.

As per above, more clarity on whether the response is blank or if there's more data to be seen.

Environment and software version (please complete the following information):

  • OS: [e.g. Ubuntu 20.04.3 LTS, Mac OS 12.1]
  • PyCardano Version [e.g. 0.1.1]

PyCardano 0.10.0.

Additional context Add any other context about the problem here.

Example:

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/ross-spencer/git/a_project/main.py", line 699, in <module>
    main()
  File "/home/ross-spencer/git/a_project/main.py", line 695, in main
    asyncio.run(cnt_main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/ross-spencer/git/a_project/main.py", line 670, in cnt_main
    messages, timestamp = await do_something()
  File "/home/ross-spencer/git/a_project/main.py", line 659, in do_something
    pool.map(do_another_thing, DEX_PAIRS)
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 367, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 774, in get
    raise self._value
pycardano.exception.TransactionFailedException: Ogmios ran into an error. Reponse: 

ross-spencer avatar Feb 14 '24 15:02 ross-spencer