broken-pipe

Why does this socket connection only allow 1 send and receive?

蹲街弑〆低调 提交于 2019-12-07 08:01:10
问题 Background I have a simple socket server setup that I am trying to allow simultaneous connections to and echo back the data. The client side launches several threads each making its own connection to the server. This works fine for the socket.send() call, but all subsequent calls cause either a "Connection reset by peer" or a "Broken pipe". Note that I have not found the change that toggles the reset and broken pipe. I have looked here on SO for a solution, but I'm afraid I may not know what

Python and FIFOs

不想你离开。 提交于 2019-12-07 03:40:13
问题 I was trying to understand FIFOs using Python under linux and I found a strange behavior i don't understand. The following is fifoserver.py import sys import time def readline(f): s = f.readline() while s == "": time.sleep(0.0001) s = f.readline() return s while True: f = open(sys.argv[1], "r") x = float(readline(f)) g = open(sys.argv[2], "w") g.write(str(x**2) + "\n") g.close() f.close() sys.stdout.write("Processed " + repr(x) + "\n") and this is fifoclient.py import sys import time def

Django collecstatic boto broken pipe on large file upload

ぐ巨炮叔叔 提交于 2019-12-06 22:01:07
问题 I am trying to upload the static files to my S3 bucket with collectstatic but i'm getting a broken pipe error with a 700k javascript file, this is the error Copying '/Users/wedonia/work/asociados/server/asociados/apps/panel/static/panel/js/js.min.js' Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in

Peewee MySQL server has gone away

一笑奈何 提交于 2019-12-05 11:53:32
I use flask and peewee. Sometimes peewee throws this error MySQL server has gone away (error(32, 'Broken pipe')) Peewee database connection db = PooledMySQLDatabase(database,**{ "passwd": password, "user": user, "max_connections":None,"stale_timeout":None, "threadlocals" : True }) @app.before_request def before_request(): db.connect() @app.teardown_request def teardown_request(exception): db.close() After mysql error that "MySQL server has gone away (error(32, 'Broken pipe'))", select queries works without problem, but insert,update,delete queries don't work. On insert,update,delete queries

Python and FIFOs

柔情痞子 提交于 2019-12-05 08:00:50
I was trying to understand FIFOs using Python under linux and I found a strange behavior i don't understand. The following is fifoserver.py import sys import time def readline(f): s = f.readline() while s == "": time.sleep(0.0001) s = f.readline() return s while True: f = open(sys.argv[1], "r") x = float(readline(f)) g = open(sys.argv[2], "w") g.write(str(x**2) + "\n") g.close() f.close() sys.stdout.write("Processed " + repr(x) + "\n") and this is fifoclient.py import sys import time def readline(f): s = f.readline() while s == "": time.sleep(0.0001) s = f.readline() return s def req(x): f =

Django collecstatic boto broken pipe on large file upload

好久不见. 提交于 2019-12-05 02:50:45
I am trying to upload the static files to my S3 bucket with collectstatic but i'm getting a broken pipe error with a 700k javascript file, this is the error Copying '/Users/wedonia/work/asociados/server/asociados/apps/panel/static/panel/js/js.min.js' Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line utility.execute() File "/Users/wedonia/work/asociados/server/envs/asociados

How to avoid a Broken Pipe error when printing a large amount of formatted data?

雨燕双飞 提交于 2019-12-03 13:33:38
问题 I am trying to print a list of tuples formatted in my stdout . For this, I use the str.format method. Everything works fine, but when I pipe the output to see the first lines using the head command a IOError occurs. Here is my code: # creating the data data = []$ for i in range(0, 1000): pid = 'pid%d' % i uid = 'uid%d' % i pname = 'pname%d' % i data.append( (pid, uid, pname) ) # find max leghed string for each field pids, uids, pnames = zip(*data) max_pid = len("%s" % max( pids) ) max_uid =

Python socket.send() can only send once, then socket.error: [Errno 32] Broken pipe occurred

强颜欢笑 提交于 2019-12-02 23:40:18
I'm a newbie in network programming, so please forgive me if this is a dumb question :) I created 1 client and 1 SocketServer.ThreadingMixIn server on Ubuntu 10.04.2 using Python2.7, but it seems like I can only call sock.send() once in client, then I'll get a: Traceback (most recent call last): File "testClient1.py", line 33, in <module> sock.send('c1:{0}'.format(n)) socket.error: [Errno 32] Broken pipe Here's the code I wrote: testClient1.py: #! /usr/bin/python2.7 # -*- coding: UTF-8 -*- import sys,socket,time,threading sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM) try: sock.connect(

xinetd service calls python script (doesn't execute properly)

依然范特西╮ 提交于 2019-12-02 08:52:24
问题 I read this: You can use xinetd to add a service starting your python script. The standard input and output will be transmitted over the network on desired port, so you do not need to modify your scripts (input/raw_input and print methods will work fine). As a result, I'm using a custom xinet service to launch script.py when a TCP connection is established to 192.168.240.37:65123. The behavior is not as desired/expected. /root/script.py #! /usr/bin/python my_name = raw_input("Enter your name:

xinetd service calls python script (doesn't execute properly)

倾然丶 夕夏残阳落幕 提交于 2019-12-02 06:44:16
I read this: You can use xinetd to add a service starting your python script. The standard input and output will be transmitted over the network on desired port, so you do not need to modify your scripts (input/raw_input and print methods will work fine). As a result, I'm using a custom xinet service to launch script.py when a TCP connection is established to 192.168.240.37:65123. The behavior is not as desired/expected. /root/script.py #! /usr/bin/python my_name = raw_input("Enter your name: ") print my_name quit() /etc/xinetd.d/netunique-server service netunique { disable = no id = netunique