2011/1/3 mdipierro <[email protected]>:
> It is also possible that sqlite was locking. Were you using sqlite?

Not direcly.
My first post only used the admin pages (no controller code).

I did several tests with and without rocket ssl support.
It is definitly more stable without.

Now I am playing with HTTP only. I added this method on the default
controller to have a simple upload method :
(got the same result with a SSH tunnel to the admin pages)

def myupload():
   form = crud.create(db.mytable)
   if form.accepts(request.vars, session):
       print 'file uploaded %s' % form.vars.myfield
       session.flash = 'file uploaded %s' % form.vars.myfield
       redirect(URL('myupload'))
   elif form.errors:
       response.flash = 'form has errors'

   return dict(form=form)

This work only for small file less than 50kb. For bigger one (60 ko)
we mostly get errors ticket like this :


web2py™ Version 1.91.5 (2010-12-28 22:12:09)
Python  Python 2.6.6: /usr/bin/python
TRACEBACK
Traceback (most recent call last):
 File "/var/web2py/gluon/main.py", line 403, in wsgibase
   parse_get_post_vars(request, environ)
 File "/var/web2py/gluon/main.py", line 254, in parse_get_post_vars
   request.body = copystream_progress(request) ### stores request body
 File "/var/web2py/gluon/main.py", line 127, in copystream_progress
   copystream(source, dest, size, chunk_size)
 File "/var/web2py/gluon/fileutils.py", line 331, in copystream
   data = src.read(chunk_size)
 File "/usr/lib/python2.6/socket.py", line 377, in read
   data = self._sock.recv(left)
timeout: timed out
ERROR SNAPSHOT
<class 'socket.timeout'>(timed out)

I tried on 2 different servers (both ot them Ubuntu 64 bits).
I will try from a different Internet cx.

Will the HTTP upload transfer be more reliable if I use a web server
front end ? (like Apache or Cherokee)

On 3 jan, 17:36, mdipierro <[email protected]> wrote:
> Are you sure about this?
>
> > But I gave up because during a file upload, the whole application were
> > unreachable :-/
>
> I think what happened is that you did not unlock the session during
> the upload and therefore you were unable to connect from the same
> browser (using the same session cookie) as the upload. This is to
> avoid session corruption. I do not think the application was
> unreachable and it should have been reachable from a different browser/
> machine.
>
> It is also possible that sqlite was locking. Were you using sqlite?
>
> I do not know about rocket ssl support. Perhaps other users have
> advice.
>
> Massimo
>
> On Jan 3, 10:28 am, PhE <[email protected]> wrote:
>
>
>
>
>
>
>
> > Thanks for your fast reply.
>
> > I got troubles with small files (50 Ko) on Internet and it may running
> > fine with large file (over 700 Mo) on LAN.
> > The target size is around 5 Mo.
>
> > This is not always reproducible.
> > I would like to investigate in this but I don't know where to look at.
> > Should I enable some log ? Should I drop web2py ssl support ?
>
> > My first attempts were with Cherokee, SSL and uWSGI.
> > But I gave up because during a file upload, the whole application were
> > unreachable :-/
> > When the transfer ended, the application recovered.
>
> > On 3 jan, 16:26, mdipierro <[email protected]> wrote:
>
> > > How big is the file? It is possible that the python ssl module cannot
> > > handle too large files because of a limited buffer (I have see this
> > > with python open-ssl before).
>
> > > This should not be a problem if you use apache for ssl.
>
> > > On Jan 3, 8:04 am, PhE <[email protected]> wrote:
>
> > > > I got strange upload issues on my app. A simple form with an upload
> > > > field fails sometimes to upload the file. It works fine on my LAN but
> > > > fails on the Internet.
> > > > I focused it down to this reproducible scenario :
>
> > > > I install a clean web2py with an ssl certificate :
>
> > > > cd /var
> > > > wgethttp://www.web2py.com/examples/static/web2py_src.zip
> > > > unzip web2py_src.zip
> > > > cd /var/web2py/
> > > > dd if=/dev/random of=rand.dat bs=1024 count=1
> > > > openssl genrsa -out cakey.key -rand rand.dat 2048
> > > > openssl req -new -key cakey.key -out cakey.csr -subj
> > > > '/C=FR/L=Paris/CN=test25656263.test.fr'
> > > > openssl x509 -req -days 1780 -set_serial 1 -in cakey.csr -signkey
> > > > cakey.key -out cakey.pem
> > > > rm -f rand.dat
>
> > > > I start web2py in SSL mode :
> > > > python web2py.py -i 0.0.0.0 -p 443 -c cakey.pem -k cakey.key
>
> > > > With the admin interface, I create my test app :
> > > > New simple application
> > > > Application name: testupload1
>
> > > > Modify db.py and add :
> > > > db.define_table('mytable',
> > > >    Field('myfield', 'upload'),
> > > >  )
>
> > > > Go to database administration : [ insert new mytable ]
> > > > select a small file (50 kb) then submit
>
> > > > Then I got :
> > > > -> "Internal error" Ticket issued ...
> > > > testupload1/81.56.220.102.2011-01-03.11-26-20.6a65f307-5eb2-4fde-915d-
> > > > d63516bc574a
> > > > -> Bad Request
>
> > > > Traceback (most recent call last):
> > > >  File "/var/web2py/gluon/main.py", line 403, in wsgibase
> > > >    parse_get_post_vars(request, environ)
> > > >  File "/var/web2py/gluon/main.py", line 254, in parse_get_post_vars
> > > >    request.body = copystream_progress(request) ### stores request body
> > > >  File "/var/web2py/gluon/main.py", line 127, in copystream_progress
> > > >    copystream(source, dest, size, chunk_size)
> > > >  File "/var/web2py/gluon/fileutils.py", line 329, in copystream
> > > >    data = src.read(size)
> > > >  File "/usr/lib/python2.6/socket.py", line 377, in read
> > > >    data = self._sock.recv(left)
> > > >  File "/usr/lib/python2.6/ssl.py", line 215, in recv
> > > >    return self.read(buflen)
> > > >  File "/usr/lib/python2.6/ssl.py", line 136, in read
> > > >    return self._sslobj.read(len)
> > > > SSLError: The read operation timed out
>
> > > > Server conf : Ubuntu 10.10 64 bits with latest web2py
> > > > Client conf : Firefox 3.6.13 on Ubuntu 10.10 32 bits
>
> > > > Help would be appreciated.

Reply via email to