Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion errno 111 time to time.

Received: by 10.204.154.76 with SMTP id n12mr1735744bkw.1.1346142568455;
        Tue, 28 Aug 2012 01:29:28 -0700 (PDT)
X-BeenThere: couchdbkit@googlegroups.com
Received: by 10.204.130.131 with SMTP id t3ls109239bks.9.gmail; Tue, 28 Aug
 2012 01:29:27 -0700 (PDT)
Received: by 10.205.139.2 with SMTP id iu2mr1732515bkc.7.1346142567407;
        Tue, 28 Aug 2012 01:29:27 -0700 (PDT)
Received: by 10.205.139.2 with SMTP id iu2mr1732514bkc.7.1346142567388;
        Tue, 28 Aug 2012 01:29:27 -0700 (PDT)
Return-Path: <bchesn...@gmail.com>
Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com [209.85.217.178])
        by gmr-mx.google.com with ESMTPS id q3si5127940bkv.1.2012.08.28.01.29.27
        (version=TLSv1/SSLv3 cipher=OTHER);
        Tue, 28 Aug 2012 01:29:27 -0700 (PDT)
Received-SPF: pass (google.com: domain of bchesn...@gmail.com designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of bchesn...@gmail.com designates 209.85.217.178 as permitted sender) smtp.mail=bchesn...@gmail.com; dkim=pass header...@gmail.com
Received: by mail-lb0-f178.google.com with SMTP id k6so3555439lbo.23
        for <couchdbkit@googlegroups.com>; Tue, 28 Aug 2012 01:29:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :content-type:content-transfer-encoding;
        bh=bjY7vrjwLbrK0C8h4ZyiTSKP2fwbraoj56iYoOzuM3Q=;
        b=nOp+3UrB79caEo5e1rXfHtzCAMv0nieZ9VW307Z3OroHKDReOkgdSBhJXQD65JwqCF
         ibUFGwShG+eJuLxeq7e8B7EK5+IeSR2FCZIFqiUmwoQKwZA0hy5ujS8BjrUaiZJCF/h2
         rx2urRm9xeEvorXs29HTVBIfQnXJ62mjdwvT6hLE+u4tSgUtUBEd7qqUjy6k64jLcUhb
         gDNSTv89B+p78fkX8fk5wHFD70iKCXWQa0CmUNh/VDYuFQaerozwJfFvD2ZT82tjhLoh
         HeimRp7dnx7H8HEHZOJTW+pfzOWowM96EbzsmjXrien/gF01Dzx7b3B/mdG47/Nj9K4c
         ACVg==
MIME-Version: 1.0
Received: by 10.152.105.173 with SMTP id gn13mr17654571lab.20.1346142567043;
 Tue, 28 Aug 2012 01:29:27 -0700 (PDT)
Received: by 10.112.80.42 with HTTP; Tue, 28 Aug 2012 01:29:26 -0700 (PDT)
In-Reply-To: <e5266694-87fe-4044-ae6e-06705939c124@googlegroups.com>
References: <e53361d7-d995-4327-897a-6530d8654d1c@googlegroups.com>
	<4A30998B-41E4-46BF-ABDB-B4BE59966...@e-engura.org>
	<5fd448e0-6b02-4900-b36c-21ca9ef09f10@googlegroups.com>
	<e5266694-87fe-4044-ae6e-06705939c124@googlegroups.com>
Date: Tue, 28 Aug 2012 10:29:26 +0200
Message-ID: <CAJNb-9rggM7=Do7u2mR+AY10-suk4tK3EvH4yBPvFPqdkZP...@mail.gmail.com>
Subject: Re: [couchdbkit] errno 111 time to time.
From: Benoit Chesneau <bchesn...@gmail.com>
To: couchdbkit@googlegroups.com
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

where so you see such errors ? in restkit or couchdb?

On Tue, Aug 28, 2012 at 2:21 AM, bussiere adrien <bussi...@gmail.com> wrote=
:
> Visibly the address is in use :
> eaddrinuse
>
> There is probably some problem with the socket and it's not closed proper=
ly
> with large file ...
>
> Reards
> Bussiere
>
> Le mardi 28 ao=FBt 2012 01:44:06 UTC+2, bussiere adrien a =E9crit :
>>
>> no i'am the lony one to make connection.
>>
>> And i'am a single user on my computer.
>>
>> I will look forward to it.
>>
>> Bussiere
>>
>> Le lundi 27 ao=FBt 2012 11:02:51 UTC+2, Benoit Chesneau a =E9crit :
>>>
>>> How frequent it is? Do you have lot of connections at this time? Errno
>>> 111 means that the connection is refused. Probably because couchdb cras=
hed
>>> and can't accept more connections. Do you have any logs in couchdb?
>>>
>>> - beno=EEt
>>>
>>> On Aug 27, 2012, at 3:35 AM, bussiere adrien <buss...@gmail.com> wrote:
>>>
>>> I have time to time the errno 111 here is my snippet :
>>> and i don't understand why :
>>> import email, getpass, imaplib, os
>>> import datetime
>>> from couchdbkit import *
>>> import unicodedata
>>> from couchdbkit.designer import push
>>> import time
>>>
>>> class Email(Document):
>>>       Sender =3D StringProperty()
>>>       Recepteur =3D StringProperty()
>>>       Content =3D StringProperty()
>>>       GmailId =3D IntegerProperty()
>>>       Date =3D DateTimeProperty()
>>>
>>>
>>>
>>>
>>>  # server object
>>> server =3D Server()
>>>
>>>  # create database
>>> db =3D server.get_or_create_db('email')
>>> #push('', db)
>>>  # associate Greeting to the db
>>> Email.set_db(db)
>>>
>>> exist =3D True
>>>
>>>
>>> detach_dir =3D '' # directory where to save attachments (default: curre=
nt)
>>> #put your username here
>>> user =3D "titi"
>>> #put your password here
>>> pwd =3D "toto"
>>>
>>> # connecting to the gmail imap server
>>> m =3D imaplib.IMAP4_SSL("imap.gmail.com")
>>> m.login(user,pwd)
>>> m.select("[Gmail]/All Mail") # here you a can choose a mail box like
>>> INBOX instead
>>> # use m.list() to get all the mailboxes
>>>
>>> resp, items =3D m.search(None, "ALL") # you could filter using the IMAP
>>> rules here (check
>>> http://www.example-code.com/csharp/imap-search-critera.asp)
>>> items =3D items[0].split() # getting the mails id
>>> i =3D 0
>>> record =3D False
>>> sleep =3D 30
>>> for emailid in items:
>>>
>>>
>>>     i +=3D 1
>>>     emailcouch =3D Email()
>>>
>>>     if i > 20640:
>>>         resp, data =3D m.fetch(emailid, "(RFC822)") # fetching the mail=
,
>>> "`(RFC822)`" means "get the whole stuff", but you can ask for headers o=
nly,
>>> etc
>>>         email_body =3D data[0][1] # getting the mail content
>>>         mail =3D email.message_from_string(email_body) # parsing the ma=
il
>>> content to get a mail object
>>>
>>>         print i
>>>         try :
>>>             print "["+mail["From"]+"] :" + mail["Subject"]
>>>
>>>         except :
>>>             try :
>>>                 print "["+mail["From"]+"] :"
>>>             except :
>>>                 pass
>>>         # fp =3D open("%d.txt"%(i), 'wb')
>>>         # fp.write(mail.__str__())
>>>         # fp.close()
>>>         #Check if any attachments at all
>>>         content =3D  unicode(mail.__str__(),errors=3D'ignore')
>>>         if (exist):
>>>             # emailcouchs =3D Email.view('email/all')
>>>             # print emailcouchs
>>>             # print emailcouchs.count()
>>>             exist =3D False
>>>             # for em in emailcouchs.all() :
>>>             #     if em.content =3D=3D content :
>>>             #         exist =3D True
>>>
>>>
>>>         else :
>>>             emailcouch.Content =3D content
>>>             emailcouch.GmailId =3D i
>>>             connection =3D False
>>>
>>>             while (connection =3D=3D False):
>>>                 try :
>>>                     emailcouch.save()
>>>                     connection =3D True
>>>                     sleep =3D 30
>>>                 except Exception as e:
>>>                     print e
>>>                     sleep =3D sleep * 2
>>>                     if sleep > 120 :
>>>                         mypass =3D 'toto'
>>>                         sudo_command =3D '/etc/init.d/couchdb restart'
>>>                         p =3D os.system('echo %s|sudo -S %s' % (mypass,
>>> sudo_command))
>>>                     time.sleep(sleep)
>>>
>>>             if mail.get_content_maintype() !=3D 'multipart':
>>>                 continue
>>>
>>>
>>>             # we use walk to creatone a generator so we can iterate on
>>> the parts and forget about the recursive headach
>>>             j =3D 0
>>>             for part in mail.walk():
>>>                 # multipart are just containers, so we skip them
>>>                 if part.get_content_maintype() =3D=3D 'multipart':
>>>                     continue
>>>
>>>                 # is this part an attachment ?
>>>                 if part.get('Content-Disposition') is None:
>>>                     continue
>>>
>>>                 filename =3D part.get_filename()
>>>                 counter =3D 1
>>>
>>>                 # if there is no filename, we create one with a counter
>>> to avoid duplicates
>>>                 if not filename:
>>>                     filename =3D 'part-%03d%s' % (counter, '.bin')
>>>                     counter +=3D 1
>>>
>>>                 att_path =3D os.path.join(detach_dir, filename)
>>>
>>>                 #Check if its already there
>>>                 att_path =3D att_path.replace("?","")
>>>                 att_path =3D att_path.replace("=3D","")
>>>                 att_path =3D att_path.replace(" ","")
>>>                 att_path =3D att_path.replace(".\\\\","")
>>>                 att_path =3D att_path.replace("\\","")
>>>                 att_path =3D att_path.replace("/","")
>>>                 att_path =3D att_path.replace("bin",".bin")
>>>
>>>                 #att_path =3D ".\\\\"+att_path
>>>                 try :
>>>                     # if not os.path.isfile(att_path) :
>>>                         # finally write the stuff
>>>                     filee =3D "__%d_%d__"%(i,j)
>>>
>>> emailcouch.put_attachment(part.get_payload(decode=3DTrue),att_path+file=
e+att_path[3:])
>>>                     connection =3D False
>>>                     while (connection =3D=3D False):
>>>                         try :
>>>                             emailcouch.save()
>>>                             connection =3D True
>>>                             sleep =3D 30
>>>                         except Exception as e:
>>>                             print e
>>>                             sleep =3D sleep * 2
>>>                             if sleep > 120 :
>>>                                 mypass =3D 'rpgjdr'
>>>                                 sudo_command =3D '/etc/init.d/couchdb
>>> restart'
>>>                                 p =3D os.system('echo %s|sudo -S %s' %
>>> (mypass, sudo_command))
>>>                             time.sleep(sleep)
>>>                         #filee =3D filee.replace("bin","\.bin")
>>>                         # fp =3D open("%s"%(att_path+filee+att_path[3:]=
),
>>> 'wb')
>>>                         # fp.write(part.get_payload(decode=3DTrue))
>>>                         # fp.close()
>>>                     # if os.path.isfile(att_path):
>>>                     #     j +=3D 1
>>>                     #     filee =3D "__%d_%d__"%(i,j)
>>>                     #     fp =3D open("%s"%(att_path+filee+att_path[3:]=
),
>>> 'wb')
>>>                     #     fp.write(part.get_payload(decode=3DTrue))
>>>                     #     fp.close()
>>>                 except :
>>>                     pass
>>>
>>> --
>>> You received this message because you are subscribed to the Google Grou=
ps
>>> "couchdbkit" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/couchdbkit/-/4rhHh7Yw0scJ.
>>> To post to this group, send email to couch...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> couchdbkit+...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/couchdbkit?hl=3Den.
>>>
>>>
> --
> You received this message because you are subscribed to the Google Groups
> "couchdbkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/couchdbkit/-/wd4h6qaxJNQJ.
>
> To post to this group, send email to couchdbkit@googlegroups.com.
> To unsubscribe from this group, send email to
> couchdbkit+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/couchdbkit?hl=3Den.