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

Update __init__.py #9

Merged
merged 1 commit into from
Jul 4, 2020
Merged

Update __init__.py #9

merged 1 commit into from
Jul 4, 2020

Conversation

hergla
Copy link
Contributor

@hergla hergla commented Aug 20, 2018

Socket should be closed if a TimeoutError happens in async def receive_one_ping(my_socket, id_, timeout):

@Crypto-Spartan
Copy link
Contributor

When I attempt to implement this fix, I get this error:

OSError: [WinError 10038] An operation was attempted on something that is not a socket

@anton-belousov
Copy link
Contributor

@Crypto-Spartan do you have a stack trace?

@anton-belousov anton-belousov merged commit fb1220a into stellarbit:master Jul 4, 2020
@Crypto-Spartan
Copy link
Contributor

@anton-belousov I updated to 0.3.0 of aioping, and it's definitely broken for me now. This is the Traceback of the error for me:

Traceback (most recent call last):                                                                                                                                                                                                                
  File "threading_with_asyncio_testing.py", line 118, in <module>                                                                                                                                                                                 
    find_alive_hosts()                                                                                                                                                                                                                            
  File "threading_with_asyncio_testing.py", line 109, in find_alive_hosts                                                                                                                                                                         
    ips_alive.extend(future.result())                                                                                                                                                                                                             
  File "C:\Program Files\Python37\lib\concurrent\futures\_base.py", line 428, in result                                                                                                                                                           
    return self.__get_result()                                                                                                                                                                                                                    
  File "C:\Program Files\Python37\lib\concurrent\futures\_base.py", line 384, in __get_result                                                                                                                                                     
    raise self._exception                                                                                                                                                                                                                         
  File "C:\Program Files\Python37\lib\concurrent\futures\thread.py", line 57, in run                                                                                                                                                              
    result = self.fn(*self.args, **self.kwargs)                                                                                                                                                                                                   
  File "threading_with_asyncio_testing.py", line 85, in thr                                                                                                                                                                                       
    completed_tasks = loop.run_until_complete(asyncio.gather(*tasks))                                                                                                                                                                             
  File "C:\Program Files\Python37\lib\asyncio\base_events.py", line 566, in run_until_complete                                                                                                                                                    
    self.run_forever()                                                                                                                                                                                                                            
  File "C:\Program Files\Python37\lib\asyncio\base_events.py", line 534, in run_forever                                                                                                                                                           
    self._run_once()                                                                                                                                                                                                                              
  File "C:\Program Files\Python37\lib\asyncio\base_events.py", line 1735, in _run_once                                                                                                                                                            
    event_list = self._selector.select(timeout)                                                                                                                                                                                                   
  File "C:\Program Files\Python37\lib\selectors.py", line 323, in select                                                                                                                                                                          
    r, w, _ = self._select(self._readers, self._writers, [], timeout)                                                                                                                                                                             
  File "C:\Program Files\Python37\lib\selectors.py", line 314, in _select                                                                                                                                                                         
    r, w, x = select.select(r, w, w, timeout)                                                                                                                                                                                                     
OSError: [WinError 10038] An operation was attempted on something that is not a socket

I know that this traceback doesn't explicitly say that it is the my_socket.close() line that is causing the issue, but from my extensive testing yesterday, I can tell you that is exactly what the problem is. I'm running Python 3.7 on Windows 10.

@Crypto-Spartan
Copy link
Contributor

I realized that the traceback above may not be the best since I'm using the threading library in that script. In this script, I'm not using the threading library at all, and I get the same error, different traceback:

Traceback (most recent call last):                                                                                                                                                                                                                
  File "C:\Program Files\Python37\lib\asyncio\runners.py", line 43, in run                                                                                                                                                                        
    return loop.run_until_complete(main)                                                                                                                                                                                                          
  File "C:\Program Files\Python37\lib\asyncio\base_events.py", line 566, in run_until_complete                                                                                                                                                    
    self.run_forever()                                                                                                                                                                                                                            
  File "C:\Program Files\Python37\lib\asyncio\base_events.py", line 534, in run_forever                                                                                                                                                           
    self._run_once()                                                                                                                                                                                                                              
  File "C:\Program Files\Python37\lib\asyncio\base_events.py", line 1735, in _run_once                                                                                                                                                            
    event_list = self._selector.select(timeout)                                                                                                                                                                                                   
  File "C:\Program Files\Python37\lib\selectors.py", line 323, in select                                                                                                                                                                          
    r, w, _ = self._select(self._readers, self._writers, [], timeout)                                                                                                                                                                             
  File "C:\Program Files\Python37\lib\selectors.py", line 314, in _select                                                                                                                                                                         
    r, w, x = select.select(r, w, w, timeout)                                                                                                                                                                                                     
OSError: [WinError 10038] An operation was attempted on something that is not a socket                                                                                                                                                            
                                                                                                                                                                                                                                                  
During handling of the above exception, another exception occurred:                                                                                                                                                                               
                                                                                                                                                                                                                                                  
Traceback (most recent call last):                                                                                                                                                                                                                
  File "ping_testing.py", line 86, in <module>                                                                                                                                                                                                    
    asyncio.run(main_loop())                                                                                                                                                                                                                      
  File "C:\Program Files\Python37\lib\asyncio\runners.py", line 46, in run                                                                                                                                                                        
    _cancel_all_tasks(loop)                                                                                                                                                                                                                       
  File "C:\Program Files\Python37\lib\asyncio\runners.py", line 62, in _cancel_all_tasks                                                                                                                                                          
    tasks.gather(*to_cancel, loop=loop, return_exceptions=True))                                                                                                                                                                                  
  File "C:\Program Files\Python37\lib\asyncio\base_events.py", line 566, in run_until_complete                                                                                                                                                    
    self.run_forever()                                                                                                                                                                                                                            
  File "C:\Program Files\Python37\lib\asyncio\base_events.py", line 534, in run_forever                                                                                                                                                           
    self._run_once()                                                                                                                                                                                                                              
  File "C:\Program Files\Python37\lib\asyncio\base_events.py", line 1735, in _run_once                                                                                                                                                            
    event_list = self._selector.select(timeout)                                                                                                                                                                                                   
  File "C:\Program Files\Python37\lib\selectors.py", line 323, in select                                                                                                                                                                          
    r, w, _ = self._select(self._readers, self._writers, [], timeout)                                                                                                                                                                             
  File "C:\Program Files\Python37\lib\selectors.py", line 314, in _select                                                                                                                                                                         
    r, w, x = select.select(r, w, w, timeout)                                                                                                                                                                                                     
OSError: [WinError 10038] An operation was attempted on something that is not a socket

@anton-belousov
Copy link
Contributor

@Crypto-Spartan thanks! Could you please also share the source of the script for the 2nd traceback? Is it just a simple ping as in an example?

@Crypto-Spartan Crypto-Spartan mentioned this pull request Jul 4, 2020
@Crypto-Spartan
Copy link
Contributor

@anton-belousov I have created an issue here. I will add a comment with the source code to both of the scripts I'm attempting to use.

Crypto-Spartan pushed a commit to Crypto-Spartan/aioping that referenced this pull request Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants