I have a problem with socket programming in Python 3. I get an exception that is not making the program crash, but is just shown in terminal.
Here is my code:
from PyQt4 import QtCore, QtGui
from imigui import Ui_MainWindow
class imiserv(QtGui.QMainWindow):
send_msg = pyqtSignal('QString', 'QString')
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.Sport_lineEdit.setMaxLength(5)
self.ui.Sconnect_pushButton.clicked.connect(self.serv)
self.send_msg.connect(self.write_msg)
def write_msg(self, lbl_msg= None, txt_msg= None):
if lbl_msg:
self.ui.C_label.setText(lbl_msg)
if txt_msg:
self.ui.Clog_textEdit.setText(txt_msg)
def serv(self):
MY_LOCK = threading.Lock()
class CountT(threading.Thread):
def __init__(self, parent):
threading.Thread.__init__(self)
self._parent= parent
def run(self):
MY_LOCK.acquire()
self._parent.send_msg.emit("Waiting connections","")
while True:
cliconn, (addr, remoport)= self._parent.clis.accept()
clirecmsg= str(cliconn.recv(1024)
self._parent.send_msg.emit("{0}:{1} is connected.".format(addr, remoport), "{0}:{1}".format(addr, remoport)
cliconn.close()
MY_LOCK.release()
try:
self.clis= socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.clis.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
clierhost= str(self.ui.Sip_lineEdit.text())
clierport= int(self.ui.Sport_lineEdit.text())
self.clis.bind((clierhost, clierport))
self.clis.listen(5)
a= CountT(self)
a.daemon= True
a.start()
except socket.error as err:
err= str(err)
print(err)
And here are the errors that happened decussate (this error show only in linux os):
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.3/threading.py", line 637, in _bootstrap_inner
self.run()
File "imiclilap.py", line 34, in run
cliconn, (addr, remoport)= self._parent.clis.accept()
File "/usr/lib/python3.3/socket.py", line 135, in accept
fd, addr = self._accept()
OSError: [Errno 22] Invalid argument
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python3.3/threading.py", line 637, in _bootstrap_inner
self.run()
File "imiclilap.py", line 34, in run
cliconn, (addr, remoport)= self._parent.clis.accept()
File "/usr/lib/python3.3/socket.py", line 135, in accept
fd, addr = self._accept()
OSError: [Errno 22] Invalid argument
I am quite new to C & Linux and I tried to setup a TCP socket server for Data exchange with a C-Code I compiled and executed on a Ubuntu System.
From a Tutorial I copied the following code (see below) and it worked to start the server and receive data (time & date) with a client code (on the same machine for test purpose).
Then I restarted the Ubuntu machine and since then I can’t start the server anymore.
I then added exception handling to the code below and it throws «unable to bind» with errorno 22, which means «invalid argument»? This doesn’t make sense to me, as the same code worked before quite good.
I assumed that the «old» socket is in a time-wait state or not closed yet, but I checked all connections with «ss -all state xxx» for all different states and everything seems alright.
Also tried to use different ports and codes — same problem.
Hope anyone can help me with this problem as I don’t know what else to try.
// C-Code Server
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
int main(int argc, char *argv[])
{
int listenfd = 0, connfd = 0;
struct sockaddr_in serv_addr;
char sendBuff[1025];
time_t ticks;
//Open a socket
listenfd = socket(AF_INET, SOCK_STREAM, 0);
memset(&serv_addr, '0', sizeof(serv_addr));
memset(sendBuff, '0', sizeof(sendBuff));
if (listenfd == -1) {
printf("Error: unable to open a socketn");
exit(1);
}
//Create an Adress
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = htons(INADDR_ANY);
serv_addr.sin_port = htons(1234);
//Macht schon benutzte Adresse mit SO_REUSEADDR nutzbar
int opt = 1;
if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(opt))<0) {
perror("setsockopt");exit(EXIT_FAILURE);
}
if(setsockopt(listenfd, SOL_SOCKET, SO_REUSEPORT, (char *)&opt, sizeof(opt))<0) {
perror("setsockopt");exit(EXIT_FAILURE);
}
bind(listenfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr));
if ((bind(listenfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr))) == -1) {
printf("Error: unable to bindn");
printf("Error code: %dn", errno);
exit(1);
}
listen(listenfd, 10);
while(1)
{
connfd = accept(listenfd, (struct sockaddr*)NULL, NULL);
if (connfd == -1) {
printf("Error: unable to accept connectionsn");
printf("Error code: %dn", errno);
exit(1);
}
ticks = time(NULL);
snprintf(sendBuff, sizeof(sendBuff), "%.24srn", ctime(&ticks));
write(connfd, sendBuff, strlen(sendBuff));
close(connfd);
sleep(1);
}
}
Reported by: tobiasbp <tobiasbp@gmail.com>
Date: Fri, 22 Jun 2012 13:12:18 UTC
Severity: normal
Found in version calendarserver/3.2+dfsg-1
Fixed in version calendarserver/3.2+dfsg-2
Done: Rahul Amaram <amaramrahul@users.sourceforge.net>
Bug is archived. No further changes may be made.
Toggle useless messages
Report forwarded
to debian-bugs-dist@lists.debian.org, Rahul Amaram <amaramrahul@users.sourceforge.net>
:
Bug#678525
; Package calendarserver
.
(Fri, 22 Jun 2012 13:12:21 GMT) (full text, mbox, link).
Acknowledgement sent
to tobiasbp <tobiasbp@gmail.com>
:
New Bug report received and forwarded. Copy sent to Rahul Amaram <amaramrahul@users.sourceforge.net>
.
(Fri, 22 Jun 2012 13:12:27 GMT) (full text, mbox, link).
Message #5 received at submit@bugs.debian.org (full text, mbox, reply):
Package: calendarserver Version: 3.2+dfsg-1 OS: Fresh install of wheezy using the image debian-wheezy-DI-a1-amd64-netinst.iso root@caldavd:/etc/caldavd# uname -a Linux caldavd 3.2.0-2-amd64 #1 SMP Mon Jun 11 17:24:18 UTC 2012 x86_64 GNU/Linux Config of /var: /dev/mapper/caldavd-var on /var type ext3 (rw,relatime,errors=continue,user_xattr,acl,barrier=1,data=ordered) System is a virtual machine (Host is KVM on Debian Wheezy) Steps to reproduce: 1. Installing the package calenderserver. 2. Enabling it in /etc/default/calendarserver 3. /etc/init.d/calenderserver start 4. Connect with browser on other machine to port 8008 on machine running calenderserver Browser hangs. I expect output from caldavd /var/log/caldavd/error.log 2012-06-22 14:17:43+0200 [-] Log opened. 2012-06-22 14:17:43+0200 [-] twistd 12.0.0 (/usr/bin/python2.7 2.7.3) starting up. 2012-06-22 14:17:43+0200 [-] reactor class: twisted.internet.pollreactor.PollReactor. 2012-06-22 14:17:43+0200 [-] AMPLoggingFactory starting on '/var/run/caldavd/caldavd.sock' 2012-06-22 14:17:43+0200 [-] CalDAVStatisticsServer starting on '/var/run/caldavd/caldavd-stats.sock' 2012-06-22 14:17:43+0200 [-] LimitingInheritingProtocolFactory starting on 8008 2012-06-22 14:17:44+0200 [-] [groupcacher] 2012-06-22 14:17:44+0200 [-] Log opened. 2012-06-22 14:17:44+0200 [-] [groupcacher] 2012-06-22 14:17:44+0200 [-] twistd 12.0.0 (/usr/bin/python2.7 2.7.3) starting up. 2012-06-22 14:17:44+0200 [-] [groupcacher] 2012-06-22 14:17:44+0200 [-] reactor class: twisted.internet.selectreactor.SelectReactor. 2012-06-22 14:17:44+0200 [-] [groupcacher] 2012-06-22 14:17:44+0200 [-] set uid/gid 104/107 2012-06-22 14:17:44+0200 [-] [groupcacher] 2012-06-22 14:17:44+0200 [-] [twistedcaldav.directory.directory.GroupMembershipCacherService#warn] Start ing group membership cacher service 2012-06-22 14:17:44+0200 [-] [caldav-0] Reading configuration from file: /etc/caldavd/caldavd.plist 2012-06-22 14:17:44+0200 [-] [caldav-0] [-] Log opened. 2012-06-22 14:17:44+0200 [-] [caldav-0] [-] twistd 12.0.0 (/usr/bin/python2.7 2.7.3) starting up. 2012-06-22 14:17:44+0200 [-] [caldav-0] [-] reactor class: twisted.internet.selectreactor.SelectReactor. 2012-06-22 14:17:44+0200 [-] [caldav-0] [-] set uid/gid 104/107 2012-06-22 14:17:44+0200 [-] [caldav-1] Reading configuration from file: /etc/caldavd/caldavd.plist 2012-06-22 14:17:44+0200 [-] [caldav-1] [-] Log opened. 2012-06-22 14:17:44+0200 [-] [caldav-1] [-] twistd 12.0.0 (/usr/bin/python2.7 2.7.3) starting up. 2012-06-22 14:17:44+0200 [-] [caldav-1] [-] reactor class: twisted.internet.selectreactor.SelectReactor. 2012-06-22 14:17:44+0200 [-] [caldav-1] [-] set uid/gid 104/107 2012-06-22 14:17:44+0200 [calendarserver.accesslog.AMPLoggingFactory] AMPLoggingProtocol connection established (HOST:UNIXAddress('/var/run/caldavd /caldavd.sock') PEER:UNIXAddress('')) 2012-06-22 14:17:44+0200 [-] [caldav-0] [-] AMP connection established (HOST:UNIXAddress(None) PEER:UNIXAddress('/var/run/caldavd/caldavd.sock')) 2012-06-22 14:17:44+0200 [calendarserver.accesslog.AMPLoggingFactory] AMPLoggingProtocol connection established (HOST:UNIXAddress('/var/run/caldavd /caldavd.sock') PEER:UNIXAddress('')) 2012-06-22 14:17:44+0200 [-] [caldav-1] [-] AMP connection established (HOST:UNIXAddress(None) PEER:UNIXAddress('/var/run/caldavd/caldavd.sock')) 2012-06-22 14:18:52+0200 [-] Unhandled Error Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 84, in callWithLogger return callWithContext({"system": lp}, func, *args, **kw) File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 69, in callWithContext return context.call({ILogContext: newCtx}, func, *args, **kw) File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext return func(*args,**kw) --- <exception caught here> --- File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 591, in _doReadOrWrite why = selectable.doWrite() File "/usr/lib/python2.7/dist-packages/twext/internet/sendfdport.py", line 139, in doWrite sendfd(self.skt.fileno(), skt.fileno(), desc) File "/usr/lib/python2.7/dist-packages/twext/python/sendfd.py", line 42, in sendfd socketfd, description, 0, [(SOL_SOCKET, SCM_RIGHTS, pack("i", fd))] socket.error: [Errno 22] Invalid argument 2012-06-22 14:18:52+0200 [-] Unhandled Error Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 84, in callWithLogger return callWithContext({"system": lp}, func, *args, **kw) File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 69, in callWithContext return context.call({ILogContext: newCtx}, func, *args, **kw) File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext return func(*args,**kw) --- <exception caught here> --- File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 591, in _doReadOrWrite why = selectable.doWrite() File "/usr/lib/python2.7/dist-packages/twext/internet/sendfdport.py", line 139, in doWrite sendfd(self.skt.fileno(), skt.fileno(), desc) File "/usr/lib/python2.7/dist-packages/twext/python/sendfd.py", line 42, in sendfd socketfd, description, 0, [(SOL_SOCKET, SCM_RIGHTS, pack("i", fd))] socket.error: [Errno 22] Invalid argument
Information forwarded
to debian-bugs-dist@lists.debian.org, Rahul Amaram <amaramrahul@users.sourceforge.net>
:
Bug#678525
; Package calendarserver
.
(Wed, 11 Jul 2012 13:48:13 GMT) (full text, mbox, link).
Acknowledgement sent
to tobiasbp <tobiasbp@gmail.com>
:
Extra info received and forwarded to list. Copy sent to Rahul Amaram <amaramrahul@users.sourceforge.net>
.
(Wed, 11 Jul 2012 13:48:13 GMT) (full text, mbox, link).
Message #10 received at 678525@bugs.debian.org (full text, mbox, reply):
To "solve" this problem, you need to disable (Set it to False) the feature "UseMetaFD" in the file /usr/lib/python2.7/dist-packages/twistedcaldav/stdconfig.py This fix was suggested by Chris Cleeland here http://old.nabble.com/calendarserver-3.2-on-Debian-unstable-throwing-error-%22socket.error%3A--Errno-22--Invalid-argument%22-out-of-the-box--ts34140527.html
Information forwarded
to debian-bugs-dist@lists.debian.org, Rahul Amaram <amaramrahul@users.sourceforge.net>
:
Bug#678525
; Package calendarserver
.
(Thu, 12 Jul 2012 07:54:09 GMT) (full text, mbox, link).
Acknowledgement sent
to tobiasbp <tobiasbp@gmail.com>
:
Extra info received and forwarded to list. Copy sent to Rahul Amaram <amaramrahul@users.sourceforge.net>
.
(Thu, 12 Jul 2012 07:54:09 GMT) (full text, mbox, link).
Message #15 received at 678525@bugs.debian.org (full text, mbox, reply):
I have now installed the 32 bit version of Wheezy. Calendarserver accepts queries on port 8008 with "UseMetaFD" enabled. This bug seems to only be relevant when running the 64 bit version of Wheezy.
Information forwarded
to debian-bugs-dist@lists.debian.org
:
Bug#678525
; Package calendarserver
.
(Thu, 12 Jul 2012 08:27:03 GMT) (full text, mbox, link).
Acknowledgement sent
to Rahul Amaram <amaramrahul@users.sourceforge.net>
:
Extra info received and forwarded to list.
(Thu, 12 Jul 2012 08:27:04 GMT) (full text, mbox, link).
Message #20 received at 678525@bugs.debian.org (full text, mbox, reply):
I am unable to reproduce this problem on my laptop running 32-bit Debian Testing. Could this bug that you mentioned be specific to 64 bit OS or perhaps your environment? Also a similar fix has been mentioned for another bug as well: http://trac.calendarserver.org/ticket/448 . I could consider setting the default value of UseMetaFD to false in the configuration file but I am not sure how that will impact other parts of the system. I will have to follow up with upstream reg. this.
Message sent on
to tobiasbp <tobiasbp@gmail.com>
:
Bug#678525.
(Wed, 18 Jul 2012 11:45:07 GMT) (full text, mbox, link).
Message #23 received at 678525-submitter@bugs.debian.org (full text, mbox, reply):
Hello, I just setup my new server with a fresh calendarserver installation and I can confirm this problem (amd64). The workaround here also temporary fixes the problem. Cheers
Information forwarded
to debian-bugs-dist@lists.debian.org, Rahul Amaram <amaramrahul@users.sourceforge.net>
:
Bug#678525
; Package calendarserver
.
(Tue, 31 Jul 2012 11:06:03 GMT) (full text, mbox, link).
Acknowledgement sent
to Marko von Oppen <marko@von-oppen.com>
:
Extra info received and forwarded to list. Copy sent to Rahul Amaram <amaramrahul@users.sourceforge.net>
.
(Tue, 31 Jul 2012 11:06:03 GMT) (full text, mbox, link).
Message #28 received at 678525@bugs.debian.org (full text, mbox, reply):
Hello, first I could also confirm the problem after upgrading for squeeze to wheezy in AMD64. The source code must not be changed to resolve the problem. Inserting <key>UseMetaFD</key> <false/> in /etc/caldavd/caldavd.plist also helps. Marko
Information forwarded
to debian-bugs-dist@lists.debian.org, Rahul Amaram <amaramrahul@users.sourceforge.net>
:
Bug#678525
; Package calendarserver
.
(Wed, 08 Aug 2012 12:00:03 GMT) (full text, mbox, link).
Acknowledgement sent
to Fredrik Unger <fred@tree.se>
:
Extra info received and forwarded to list. Copy sent to Rahul Amaram <amaramrahul@users.sourceforge.net>
.
(Wed, 08 Aug 2012 12:00:03 GMT) (full text, mbox, link).
Message #33 received at 678525@bugs.debian.org (full text, mbox, reply):
Hi, while debugging the problem, this patch fixed the problem. --- calendarserver-3.2+dfsg.orig/twext/python/sendmsg.c +++ calendarserver-3.2+dfsg/twext/python/sendmsg.c @@ -238,7 +238,7 @@ static PyObject *sendmsg_sendmsg(PyObjec } control_message->cmsg_level = level; - control_message->cmsg_type = type; + control_message->cmsg_type = SCM_RIGHTS; data_size = CMSG_LEN(data_len); if (data_size > SOCKLEN_MAX) { A proper fix is needed, possibly reading the values in the first loop. That is up to the developers. More information : http://lists.macosforge.org/pipermail/calendarserver-users/2012-August/002032.html /Fred
Information forwarded
to debian-bugs-dist@lists.debian.org, Rahul Amaram <amaramrahul@users.sourceforge.net>
:
Bug#678525
; Package calendarserver
.
(Mon, 13 Aug 2012 10:51:03 GMT) (full text, mbox, link).
Acknowledgement sent
to Fredrik Unger <fred@tree.se>
:
Extra info received and forwarded to list. Copy sent to Rahul Amaram <amaramrahul@users.sourceforge.net>
.
(Mon, 13 Aug 2012 10:51:03 GMT) (full text, mbox, link).
Message #38 received at 678525@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/plain, inline)]
Hi, After further analyzing the problem and with help from Glyph Lefkowitz, Chris Cleeland and Rahul Amaram, I managed to create a test case that proved it is a gcc bug. The included tar file includes a simple testcase that can be run under Debian. The c file that is the base for this bugreport can be found here : http://trac.calendarserver.org/browser/CalendarServer/trunk/twext/python/sendmsg.c tar xvfz gcc-bug.tar.gz make fail python sender.py produces the faulty output : SCM_RIGHTS constant : 1 First call level 1 type 1 2a 00 00 00 (4) Second call level 1 type 0 2a 00 00 00 (4) This is using the current gcc in Debian sid : gcc (Debian 4.7.1-6) 4.7.1 make ok python sender.py produces the correct output : SCM_RIGHTS constant : 1 First call level 1 type 1 2a 00 00 00 (4) Second call level 1 type 1 2a 00 00 00 (4) This using current gcc-4.6 in Debian sid : gcc-4.6 (Debian 4.6.3-8) 4.6.3 The first and the second call should produce the same output but in the faulty run type becomes 0. Due to the 0, the linux kernel check in http://lxr.linux.no/linux+v3.2/net/core/scm.c#L159 fails, and gives the Invalid Argument error. The problem can be worked around in Debian and this bug can be closed once it is has been done. /Fred
[gcc-bug.tar.gz (application/gzip, attachment)]
Information forwarded
to debian-bugs-dist@lists.debian.org, Rahul Amaram <amaramrahul@users.sourceforge.net>
:
Bug#678525
; Package calendarserver
.
(Mon, 13 Aug 2012 13:30:08 GMT) (full text, mbox, link).
Acknowledgement sent
to Fredrik Unger <fred@tree.se>
:
Extra info received and forwarded to list. Copy sent to Rahul Amaram <amaramrahul@users.sourceforge.net>
.
(Mon, 13 Aug 2012 13:30:08 GMT) (full text, mbox, link).
Message #43 received at 678525@bugs.debian.org (full text, mbox, reply):
On 08/13/2012 02:58 PM, Rahul Amaram wrote: > Thanks for the additional information Fredrik. Your analysis was really > helpful. Could you please raise a new Debian GCC bug? If they fix it, > then we'll have no need to make any changes in calendarserver Debian. > Else we will have to force compilation of the package with gcc 4.6. I opened a new bug towards the gcc package. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684716 Maybe you can make this bug depend on that bug, or just have a temporary patch until the problem with GCC have been solved. /Fred
Information forwarded
to debian-bugs-dist@lists.debian.org
:
Bug#678525
; Package calendarserver
.
(Mon, 13 Aug 2012 15:51:03 GMT) (full text, mbox, link).
Acknowledgement sent
to Rahul Amaram <amaramrahul@users.sourceforge.net>
:
Extra info received and forwarded to list.
(Mon, 13 Aug 2012 15:51:03 GMT) (full text, mbox, link).
Message #48 received at 678525@bugs.debian.org (full text, mbox, reply):
Thanks for the additional information Fredrik. Your analysis was really helpful. Could you please raise a new Debian GCC bug? If they fix it, then we'll have no need to make any changes in calendarserver Debian. Else we will have to force compilation of the package with gcc 4.6.
Information forwarded
to debian-bugs-dist@lists.debian.org, Rahul Amaram <amaramrahul@users.sourceforge.net>
:
Bug#678525
; Package calendarserver
.
(Mon, 13 Aug 2012 23:21:02 GMT) (full text, mbox, link).
Acknowledgement sent
to "James Y Knight" <foom@fuhm.net>
:
Extra info received and forwarded to list. Copy sent to Rahul Amaram <amaramrahul@users.sourceforge.net>
.
(Mon, 13 Aug 2012 23:21:03 GMT) (full text, mbox, link).
Message #53 received at 678525@bugs.debian.org (full text, mbox, reply):
It's not a bug in GCC. It's a bug in the code. The second call to PyArg_ParseTuple passes an int* where a Py_ssize_t* should be passed. (The &data_len argument).
Information forwarded
to debian-bugs-dist@lists.debian.org
:
Bug#678525
; Package calendarserver
.
(Tue, 14 Aug 2012 09:24:08 GMT) (full text, mbox, link).
Acknowledgement sent
to Rahul Amaram <amaramrahul@users.sourceforge.net>
:
Extra info received and forwarded to list.
(Tue, 14 Aug 2012 09:24:08 GMT) (full text, mbox, link).
Message #58 received at 678525@bugs.debian.org (full text, mbox, reply):
James, thanks for pointing out this. You are right. Using Py_ssize_t* instead of int* has indeed fixed the problem. We somehow were misguided reg. the problem. Thanks once again for taking the time to look into this.
Reply sent
to Rahul Amaram <amaramrahul@users.sourceforge.net>
:
You have taken responsibility.
(Thu, 16 Aug 2012 07:15:06 GMT) (full text, mbox, link).
Notification sent
to tobiasbp <tobiasbp@gmail.com>
:
Bug acknowledged by developer.
(Thu, 16 Aug 2012 07:15:06 GMT) (full text, mbox, link).
Message #63 received at 678525-close@bugs.debian.org (full text, mbox, reply):
Source: calendarserver Source-Version: 3.2+dfsg-2 We believe that the bug you reported is fixed in the latest version of calendarserver, which is due to be installed in the Debian FTP archive. A summary of the changes between this version and the previous one is attached. Thank you for reporting the bug, which will now be closed. If you have further comments please address them to 678525@bugs.debian.org, and the maintainer will reopen the bug report if appropriate. Debian distribution maintenance software pp. Rahul Amaram <amaramrahul@users.sourceforge.net> (supplier of updated calendarserver package) (This message was generated automatically at their request; if you believe that there is a problem with it please contact the archive administrators by mailing ftpmaster@debian.org) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Format: 1.8 Date: Tue, 14 Aug 2012 22:08:02 +0530 Source: calendarserver Binary: calendarserver Architecture: source i386 Version: 3.2+dfsg-2 Distribution: unstable Urgency: low Maintainer: Rahul Amaram <amaramrahul@users.sourceforge.net> Changed-By: Rahul Amaram <amaramrahul@users.sourceforge.net> Description: calendarserver - Apple's Calendar and Contacts Server Closes: 678525 681170 684996 Changes: calendarserver (3.2+dfsg-2) unstable; urgency=low . * The second call to PyArg_ParseTuple in sendmsg.c passed an int* where a Py_ssize_t* should be passed. This has been fixed. (Closes: #678525) * Added option "EnableSSL" to conf/caldavd.plist. This has to be set to true for calendarserver to listen on SSL port. (Closes: #681170) * Changed source dependency from pyton-dev to python-all-dev as now a fix for building package for both python 2.6 and python 2.7 is provided. (Thanks to Fredrik Unger for providing the fix) (Closes: #684996) * Updated calendarserver.README.Debian * Bumped Debian compat to 9 Checksums-Sha1: c8849d079ca1df22a768fffcb7ead9944a216f72 1325 calendarserver_3.2+dfsg-2.dsc a60cad4d8b60e93bcad2ee0954fe55222ffcad81 20748 calendarserver_3.2+dfsg-2.debian.tar.gz 2083b225e37caec3efd116e0f99204eeb1e317b5 1505066 calendarserver_3.2+dfsg-2_i386.deb Checksums-Sha256: b19e4560845f8a9e7e6ee864156fc949156882dbde6996e15f76befe88047aec 1325 calendarserver_3.2+dfsg-2.dsc e1d45ff653cd08092ea32b2e785707e572b3fad386d73f35f4fa52650fa2e394 20748 calendarserver_3.2+dfsg-2.debian.tar.gz 44015891b9d37a65e463c26152e2d283749d9cf6e7d313c1b4a951c41d5d6944 1505066 calendarserver_3.2+dfsg-2_i386.deb Files: a8c26f3b32e6758819cf998e8e4de91c 1325 net optional calendarserver_3.2+dfsg-2.dsc b5c152f04f10a050cb8682cbf21990f0 20748 net optional calendarserver_3.2+dfsg-2.debian.tar.gz 8750873f22d557b6af8625af194a3612 1505066 net optional calendarserver_3.2+dfsg-2_i386.deb -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iD8DBQFQK/2mn88szT8+ZCYRAixpAJ9T/PZJznhBUGQkELFdfRACMI93xACfYJAk fdlP8kIBhS9MxFc+TQrZ5yU= =C6w3 -----END PGP SIGNATURE-----
Bug archived.
Request was from Debbugs Internal Request <owner@bugs.debian.org>
to internal_control@bugs.debian.org
.
(Fri, 19 Oct 2012 07:26:05 GMT) (full text, mbox, link).
Send a report that this bug log contains spam.
Debian bug tracking system administrator <owner@bugs.debian.org>.
Last modified:
Fri Feb 10 02:43:37 2023;
Machine Name:
bembo
Debian Bug tracking system
Debbugs is free software and licensed under the terms of the GNU
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.
Copyright © 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson,
2005-2017 Don Armstrong, and many other contributors.
У меня проблема с программированием сокетов в Python 3. Я получаю исключение, которое не приводит к сбою программы, а просто отображается в терминале.
Вот мой код:
from PyQt4 import QtCore, QtGui
from imigui import Ui_MainWindow
class imiserv(QtGui.QMainWindow):
send_msg = pyqtSignal('QString', 'QString')
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.Sport_lineEdit.setMaxLength(5)
self.ui.Sconnect_pushButton.clicked.connect(self.serv)
self.send_msg.connect(self.write_msg)
def write_msg(self, lbl_msg= None, txt_msg= None):
if lbl_msg:
self.ui.C_label.setText(lbl_msg)
if txt_msg:
self.ui.Clog_textEdit.setText(txt_msg)
def serv(self):
MY_LOCK = threading.Lock()
class CountT(threading.Thread):
def __init__(self, parent):
threading.Thread.__init__(self)
self._parent= parent
def run(self):
MY_LOCK.acquire()
self._parent.send_msg.emit("Waiting connections","")
while True:
cliconn, (addr, remoport)= self._parent.clis.accept()
clirecmsg= str(cliconn.recv(1024)
self._parent.send_msg.emit("{0}:{1} is connected.".format(addr, remoport), "{0}:{1}".format(addr, remoport)
cliconn.close()
MY_LOCK.release()
try:
self.clis= socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.clis.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
clierhost= str(self.ui.Sip_lineEdit.text())
clierport= int(self.ui.Sport_lineEdit.text())
self.clis.bind((clierhost, clierport))
self.clis.listen(5)
a= CountT(self)
a.daemon= True
a.start()
except socket.error as err:
err= str(err)
print(err)
И вот ошибки, которые произошли в перекрестном порядке (эта ошибка отображается только в ОС Linux):
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.3/threading.py", line 637, in _bootstrap_inner
self.run()
File "imiclilap.py", line 34, in run
cliconn, (addr, remoport)= self._parent.clis.accept()
File "/usr/lib/python3.3/socket.py", line 135, in accept
fd, addr = self._accept()
OSError: [Errno 22] Invalid argument
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python3.3/threading.py", line 637, in _bootstrap_inner
self.run()
File "imiclilap.py", line 34, in run
cliconn, (addr, remoport)= self._parent.clis.accept()
File "/usr/lib/python3.3/socket.py", line 135, in accept
fd, addr = self._accept()
OSError: [Errno 22] Invalid argument
@sunilmut — the python2 script below should repro it in several minutes (with default settings)
#!/usr/bin/env python # repro global tcp error in WSL, tcp ports are not released if SYN failed import sys, os import time import errno import select import socket if os.environ.get('TEST_TCP6'): af = socket.AF_INET6 phost = '::1' else: af = socket.AF_INET phost = '127.0.0.1' pport_start = 12400 if len(sys.argv)>1: pport_end = min(pport_start + int(sys.argv[1]), pport_start + 1000) else: pport_end = pport_start + 120 target_addrs = [ (phost, x) for x in xrange(pport_start, pport_end) ] poller = select.epoll() mapping = {} print 'peer ports [ %d, %d )' % (pport_start, pport_end) reconns = target_addrs[:] t0 = time.time() t_pre = t0 n = 0 while 1: if len(reconns) == 0 and time.time() - t_pre > 3.0: print "test done: empty reconns list last long" exit() for paddr in reconns: sock = socket.socket(af) sock.setblocking(False) mapping[sock.fileno()] = (paddr, sock) try: print "try conn", paddr n+=1 sock.connect(paddr) except socket.error as e: if e.errno == errno.EINPROGRESS: poller.register(sock.fileno(), select.EPOLLOUT|select.EPOLLWRNORM) else: sys.stdout.write('naddr {}: e {} {} - counter {} tspan {}n'.format(paddr, errno.errorcode[e.errno], e.strerror, n, time.time() - t0)) exit() else: print paddr, "direct done" print 'sock', sock.getsockname() reconns[:] = [] rpolls = poller.poll() for fd,evs in rpolls: paddr, sock = mapping[fd] if evs & (select.EPOLLHUP |select.EPOLLERR): print paddr, "hangup evs", evs poller.unregister(fd) sock.close() reconns.append(paddr) del mapping[fd] elif evs & (select.EPOLLOUT|select.EPOLLWRNORM): print paddr, "connected" poller.unregister(fd) else: sys.stdout.write('naddr {}:unhandled ev {} - counter {}n'.format(paddr, evs, n)) exit() if len(rpolls): t_pre = time.time()