web.py on apache gives a Socket operation on non-socket - python

What can cause this error?
I get these errors every time a client accesses my server.
it hapens only once in each request.
the script runs with seemingly no problems, but i don't know if there are hidden implications or complication that result from this error that i'm not aware of.
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/flup/server/fcgi_base.py", line 982, in _setupSocket
sock.getpeername()
fcgi_base
error: [Errno 88] Socket operation on non-socket
i'm running python as cgi ,web.py, linux (ubuntu12)
what can be the cause of this error?
How can I investigate it?

Related

Python telnet connection abruptly ends

I'm currently working on a programme to automate some function for router configuration and I've managed to create a loopback interface between GNS3 and my computer so that I can connect python via telnet.
At first, the code ran smoothly and I had no problem, but when I switched to another router, it works only for a few commands and then it suddenly stops and I can't figure why.
This is the error I get:
Traceback (most recent call last):
File "C:\Licenta - program\test1\main.py", line 147, in <module>
tn.write(b"ip add ")
File "C:\Users\carme\AppData\Local\Programs\Python\Python39\lib\telnetlib.py", line 292, in write
self.sock.sendall(buffer)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
Any suggestions are welcomed!
Thank you!

How to debug an access violation in atexit

A very large application I am working has a segfault when I shut it down. If I use faulthandler, it says there is an access violation in atexit
Current thread 0x00000a8c (most recent call first):
File "C:\Python27\lib\atexit.py", line 24 in _run_exitfuncs
Windows exception: access violation
Current thread 0x00000a8c (most recent call first):
File "C:\Python27\lib\atexit.py", line 24 in _run_exitfuncs
Segmentation fault
That really doesn't tell me much. When I debug through the code, it goes all the way through main and out. The debugger won't step anymore after that, even though the program isn't all the way done yet. If I let it continue, it just does the segfault and doesn't show me anything.
I imagine it is some library we are using, but how to identify it?

SSH via python (paramiko) error: "'_EllipticCurvePublicKey' object has no attribute 'verify'"

I am trying to connect to a SSH server using the python library paramiko.
The same code worked on the same computer before, but it started to show a warning when trying to connect. I can connect to the SSH server using the same computer and same users via terminal. The python code also works on other computers connected to the same LAN network.
I also tried to restart both pcs and reinstall paramiko with no success.
Following is the code and the warning message presented.
class SSH:
def __init__(self, ip):
self.ssh = SSHClient()
self.ssh.load_system_host_keys()
self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.ssh.connect(hostname=ip ,username='urs',password='pass')
Warning message:
Unknown exception: '_EllipticCurvePublicKey' object has no attribute 'verify'
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/paramiko/transport.py", line 1886, in run
self.kex_engine.parse_next(ptype, m)
File "/usr/local/lib/python3.5/dist-packages/paramiko/kex_ecdh_nist.py", line 47, in parse_next
return self._parse_kexecdh_reply(m)
File "/usr/local/lib/python3.5/dist-packages/paramiko/kex_ecdh_nist.py", line 105, in _parse_kexecdh_reply
self.transport._verify_key(K_S, sig)
File "/usr/local/lib/python3.5/dist-packages/paramiko/transport.py", line 1748, in _verify_key
if not key.verify_ssh_sig(self.H, Message(sig)):
File "/usr/local/lib/python3.5/dist-packages/paramiko/ecdsakey.py", line 216, in verify_ssh_sig
self.verifying_key.verify(
AttributeError: '_EllipticCurvePublicKey' object has no attribute 'verify'
Do anybody have a suggestion about where the problem might be?
I tried to google and looked for the error here,but couldn't find it anywhere.
Thanks in advance!
I had the exact same error as now. I encountered this error with paramiko version 2.3.0. I downgraded to 2.1.2 and the operation i was doing proceeded normally.

ws4py appears a error in Linux system

I use ws4py as a websocket server. it can run normally in Windows and Mac, but it runs in linux system raising a TB when websocket clients connect to server. Anybody can tell me how to fix this bug?
[2016-01-06 20:51:43,094] ERROR Failed to receive data
Traceback (most recent call last):
File "/home/yzliu/airtest/env/local/lib/python2.7/site-packages/ws4py/websocket.py", line 300, in once
b = self.sock.recv(self.reading_buffer_size)
File "/home/yzliu/airtest/env/local/lib/python2.7/site-packages/gevent/_socket2.py", line 264, in recv
return sock.recv(*args)
File "/home/yzliu/airtest/env/local/lib/python2.7/site-packages/gevent/_socket2.py", line 73, in _dummy
raise error(EBADF, 'Bad file descriptor')
This is a bug in ws4py, when used with gevent 1.1, as the underlying
socket is closed when WSGI handler returns.
See: https://github.com/Lawouach/WebSocket-for-Python/pull/180/files

Problem with the ipy.vim script

I'm trying to use the ipy.vim script to set up a small python dev environment, but I'm running into a connection problem. When I type ipy_vimserver.setup("demo") I get this error:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
self.run()
File "/usr/lib/pymodules/python2.6/IPython/Extensions/ipy_vimserver.py", line 109, in serve_me
self.listen()
File "/usr/lib/pymodules/python2.6/IPython/Extensions/ipy_vimserver.py", line 93, in listen
self.socket.bind(self.__sname)
File "<string>", line 1, in bind
error: [Errno 98] Address already in use
When I type it a second time, everything is fine but when I launch gvim the F4/F5 command do nothing and state that they can't connect to the Ipython server.
any suggestion?
Problem:
Look at the last line of the stack trace: error: [Errno 98] Address already in use
Explanation:
A nice explanation of "Address already in use" error can be found here: "Bind: Address Already in Use"
Possible Solution:
As I have not tried ipy.vim setup myself, from networking point of view, a quick suggestion would be to:
close/kill both the server (ipython server) and the client (vim running ipy.vim).
Restart ipython server
Run vim with ipy.vim and try to debug.
Additional Info:
On Linux/Unix machines, the timeout values are defined in /proc/sys/net/ipv4/tcp_keepalive_time and /proc/sys/net/ipv4/tcp_fin_time
On Windows machines, this is set in HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\TcpTimedWaitDelay. More details is here: TcpTimedWaitDelay
If I run the exact same code I get the same error. If I change the name from "demo" to, for example, "cookies" it works. Hmm....
This happens when there's already a socket with the name you're trying to create, in this case 'demo'. You need to delete it before doing the ipy_vimserver.setup - in your case, the socket file to delete is ~/.ipython/demo
(I'm one of the authors of ipy.vim)

Categories