Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in thread NetGear, zmq.error.Again: Resource temporarily unavailable #390

Open
4 tasks done
sourabCV opened this issue Mar 29, 2024 · 7 comments
Open
4 tasks done
Assignees
Labels
DOCS 📜 Issue/PR is related to vidgear docs. ENHANCEMENT ⚡ New Feature/Addition/Improvement WAITING TO TEST ⏲️ Asked user to test the suggested example/binary/solution
Milestone

Comments

@sourabCV
Copy link

Issue guidelines

Issue Checklist

  • I have searched open or closed issues for my problem and found nothing related or helpful.
  • I have read the Documentation and found nothing related to my problem.
  • I have gone through the Bonus Examples and FAQs and found nothing related or helpful.

Describe your Question

In my code, I used Netgear for video transfer in the cloud. On that code, I received a NetGear thread error in the long run.

Terminal log output(Optional)

Exception in thread NetGear:
Traceback (most recent call last):
  File "C:\Users\SchneiderElectric\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "C:\Users\SchneiderElectric\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 982, in run   
    self._target(*self._args, **self._kwargs)
  File "C:\DefectScanner\venv3\Lib\site-packages\vidgear\gears\netgear.py", line 972, in __recv_handler
    msg_json = self.__msg_socket.recv_json(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\DefectScanner\venv3\Lib\site-packages\zmq\sugar\socket.py", line 941, in recv_json
    msg = self.recv(flags)
          ^^^^^^^^^^^^^^^^
  File "zmq\backend\cython\socket.pyx", line 809, in zmq.backend.cython.socket.Socket.recv
  File "zmq\backend\cython\socket.pyx", line 845, in zmq.backend.cython.socket.Socket.recv
  File "zmq\backend\cython\socket.pyx", line 199, in zmq.backend.cython.socket._recv_copy
  File "zmq\backend\cython\socket.pyx", line 194, in zmq.backend.cython.socket._recv_copy
  File "zmq\backend\cython\checkrc.pxd", line 22, in zmq.backend.cython.checkrc._check_rc
zmq.error.Again: Resource temporarily unavailable

Python Code(Optional)

from vidgear.gears import NetGear

options = {"max_retries":2,"request_timeout":5,"flag":1,"copy": False, "track": False}
client = NetGear(receive_mode=True, address="0.0.0.0", port="12345",protocol="tcp",pattern=1,**options,)

frame = client.recv()

VidGear Version

0.3.2

Python version

3.11.6

Operating System version

windows10

Any other Relevant Information?

I dont want to use pattern 2 and how can I solve this error or how can I catch this error in a try, exception block pls suggest

@sourabCV sourabCV added the QUESTION ❓ User asked about the working/usage of VidGear APIs. label Mar 29, 2024
Copy link

welcome bot commented Mar 29, 2024

Thanks for opening this issue, a maintainer will get back to you shortly!

In the meantime:

  • Read our Issue Guidelines, and update your issue accordingly. Please note that your issue will be fixed much faster if you spend about half an hour preparing it, including the exact reproduction steps and a demo.
  • Go comprehensively through our dedicated FAQ & Troubleshooting section.
  • For any quick questions and typos, please refrain from opening an issue, as you can reach us on Gitter community channel.

@sourabCV
Copy link
Author

sourabCV commented Apr 3, 2024

any solution?

@abhiTronix
Copy link
Owner

abhiTronix commented Apr 5, 2024

I received a NetGear thread error in the long run.

Meaning your connection is unstable.

any solution?

Yes, try removing these flags: "flag":1,"copy": False, "track": False. Specifically flag=1 which enables ZMQ_DONTWAIT.
Also you could use pattern=2 in your script, which is zmq.PUB/zmq.SUB (ZMQ Publish/Subscribe Pattern) with NetGear API. In this pattern, both Server and Client end works independently and messages are published without the knowledge of what or if any subscriber of that knowledge exists. No single publisher overwhelms the subscriber. The messages from both publishers are interleaved.

@abhiTronix
Copy link
Owner

abhiTronix commented Apr 5, 2024

More knowledge about this error:
ZMQ Python wrappers raise zmq.error.Again if the underlying C API returns EAGAIN. You could follow zmq_recv documentation, which states:

  • ZMQ_DONTWAIT: Specifies that the operation should be performed in non-blocking mode. If there are no messages available on the specified socket, the zmq_recv() function shall fail with errno set to EAGAIN.
  • EAGAIN: Non-blocking mode was requested and no messages are available at the moment.

Solution: @sourabCV Try removing these flags: "flag":1,"copy": False, "track": False

@abhiTronix abhiTronix added WAITING TO TEST ⏲️ Asked user to test the suggested example/binary/solution SOLVED 🏁 This issue/PR is resolved now. Goal Achieved! WAITING FOR RESPONSE ⏳ Waiting for the user response. labels Apr 5, 2024
@abhiTronix
Copy link
Owner

I'll remove these parameters from docs.

@abhiTronix abhiTronix reopened this Apr 5, 2024
@abhiTronix abhiTronix added DOCS 📜 Issue/PR is related to vidgear docs. and removed QUESTION ❓ User asked about the working/usage of VidGear APIs. SOLVED 🏁 This issue/PR is resolved now. Goal Achieved! labels Apr 5, 2024
@abhiTronix abhiTronix self-assigned this Apr 5, 2024
@abhiTronix abhiTronix added this to To do in VidGear v0.3.3 via automation Apr 5, 2024
@abhiTronix abhiTronix added this to the v0.3.3 milestone Apr 5, 2024
@abhiTronix abhiTronix added the ENHANCEMENT ⚡ New Feature/Addition/Improvement label Apr 5, 2024
@sourabCV
Copy link
Author

sourabCV commented Apr 5, 2024

Thanks for your response

Today i removed that flags and all, now waiting for 48 hours to check this worked or not

pattern=2 also used one time but that also generate a different error after this error confermation i will show you pattern 2 error

@abhiTronix abhiTronix removed the WAITING FOR RESPONSE ⏳ Waiting for the user response. label Apr 5, 2024
@sourabCV
Copy link
Author

After removing the flag it's working. Thank you for your support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DOCS 📜 Issue/PR is related to vidgear docs. ENHANCEMENT ⚡ New Feature/Addition/Improvement WAITING TO TEST ⏲️ Asked user to test the suggested example/binary/solution
Projects
Development

No branches or pull requests

2 participants