Errors using web2py 2.18.5 , python3 and ssl

397 views
Skip to first unread message

icodk

unread,
Jun 23, 2019, 7:19:41 AM6/23/19
to web2py-users
plan web2py 2.18.5 installation on windows from source on Windows 10 running the welcome application without errors.
However trying to run it with SSL gives the following errors:
Command :
C:\Python37\python.exe C:\temp\web2py\web2py.py -c C:\temp\web2py\cert\ca.crt -k C:\temp\web2py\cert\ca.key -a "password" -i 192.168.1.100 -p 443

Errors:

C:\Temp\web2py>C:\Python37\python.exe C:\temp\web2py\web2py.py -c C:\temp\web2py\cert\ca.crt -k C:\temp\web2py\cert\ca.key -a "password" -i 192.168.1.100 -p 443
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2019
Version 2.18.5-stable+timestamp.2019.04.07.21.13.59
Database drivers available: sqlite3, psycopg2, imaplib, pymysql, pyodbc

please visit:
use "taskkill /f /pid 13408" to shutdown the web2py server


Exception in thread Thread-2:
Traceback (most recent call last):
  File "C:\Python37\lib\threading.py", line 917, in _bootstrap_inner
    self.run()
  File "C:\temp\web2py\gluon\rocket.py", line 1268, in run
    conn = Connection(*conn)
  File "C:\temp\web2py\gluon\rocket.py", line 105, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [WinError 10038] An operation was attempted on something that is not a socket

Exception in thread Thread-3:
Traceback (most recent call last):
  File "C:\Python37\lib\threading.py", line 917, in _bootstrap_inner
    self.run()
  File "C:\temp\web2py\gluon\rocket.py", line 1268, in run
    conn = Connection(*conn)
  File "C:\temp\web2py\gluon\rocket.py", line 105, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [WinError 10038] An operation was attempted on something that is not a socket

Exception in thread Thread-5:
Traceback (most recent call last):
  File "C:\Python37\lib\threading.py", line 917, in _bootstrap_inner
    self.run()
  File "C:\temp\web2py\gluon\rocket.py", line 1268, in run
    conn = Connection(*conn)
  File "C:\temp\web2py\gluon\rocket.py", line 105, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [WinError 10038] An operation was attempted on something that is not a socket

Exception in thread Thread-6:
Traceback (most recent call last):
  File "C:\Python37\lib\threading.py", line 917, in _bootstrap_inner
    self.run()
  File "C:\temp\web2py\gluon\rocket.py", line 1268, in run
    conn = Connection(*conn)
  File "C:\temp\web2py\gluon\rocket.py", line 105, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [WinError 10038] An operation was attempted on something that is not a socket

Exception in thread Thread-7:
Traceback (most recent call last):
  File "C:\Python37\lib\threading.py", line 917, in _bootstrap_inner
    self.run()
  File "C:\temp\web2py\gluon\rocket.py", line 1268, in run
    conn = Connection(*conn)
  File "C:\temp\web2py\gluon\rocket.py", line 105, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [WinError 10038] An operation was attempted on something that is not a socket

Exception in thread Thread-8:
Traceback (most recent call last):
  File "C:\Python37\lib\threading.py", line 917, in _bootstrap_inner
    self.run()
  File "C:\temp\web2py\gluon\rocket.py", line 1268, in run
    conn = Connection(*conn)
  File "C:\temp\web2py\gluon\rocket.py", line 105, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [WinError 10038] An operation was attempted on something that is not a socket

Exception in thread Thread-9:
Traceback (most recent call last):
  File "C:\Python37\lib\threading.py", line 917, in _bootstrap_inner
    self.run()
  File "C:\temp\web2py\gluon\rocket.py", line 1268, in run
    conn = Connection(*conn)
  File "C:\temp\web2py\gluon\rocket.py", line 105, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [WinError 10038] An operation was attempted on something that is not a socket

Dave S

unread,
Jun 24, 2019, 4:27:05 PM6/24/19
to web2py-users


On Sunday, June 23, 2019 at 4:19:41 AM UTC-7, icodk wrote:
plan web2py 2.18.5 installation on windows from source on Windows 10 running the welcome application without errors.
However trying to run it with SSL gives the following errors:
Command :
C:\Python37\python.exe C:\temp\web2py\web2py.py -c C:\temp\web2py\cert\ca.crt -k C:\temp\web2py\cert\ca.key -a "password" -i 192.168.1.100 -p 443


Are you running with elevated privilege (i.e., opening cmd.exe with "Run as Administrator") ?

Port 443  requires privilege on Linux, and it wouldn't be a surprise if that was the case on Windows.


 

/dps

icodk

unread,
Jun 24, 2019, 5:37:32 PM6/24/19
to web2py-users
yes. I run it in  Administrator Command prompt. 
What else could I be missing ?
Will try on another Windows 10  machine  and linux.

Dave S

unread,
Jun 24, 2019, 11:14:50 PM6/24/19
to web2py-users


On Monday, June 24, 2019 at 2:37:32 PM UTC-7, icodk wrote:
yes. I run it in  Administrator Command prompt. 
What else could I be missing ?
Will try on another Windows 10  machine  and linux.


Did you check if port 443 was already in use?  Try
netstat -ab
(note the dash)

/dps
 

icodk

unread,
Jun 25, 2019, 5:26:55 AM6/25/19
to web2py-users
yes and it is python.exe that own the prort. Also the server serves the index.html page but then it hangs

icodk

unread,
Jun 25, 2019, 1:04:39 PM6/25/19
to web2py-users
Now I tried both another Windows 10 machine and ubuntu with similar errors
As you can see bellow I used port 8000 on liniux because using port 443 gave the following error:

ERROR:Rocket.Errors.Port443:Socket 0.0.0.0:443 in use by other process and it won't share.
WARNING:Rocket.Errors.Port443:Listener started when not ready.

However, netstat didn't revile any process using 443 and nc could listen on this port 
$ sudo nc -l  -p 443


and receive connections from another machine (telnet 192.168.1.223 443)



The error from the server on linux
$ python3 web2py.py -c cert/ca.crt -k cert/ca.key -a "password" -i 192.168.1.223 -p 8000
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2019
Version 2.18.5-stable+timestamp.2019.04.07.21.13.59
Database drivers available: sqlite3, imaplib, pymysql

please visit:
use "kill -SIGTERM 7818" to shutdown the web2py server


Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/home/ico/web2py/gluon/rocket.py", line 1268, in run
    conn = Connection(*conn)
  File "/home/ico/web2py/gluon/rocket.py", line 105, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [Errno 9] Bad file descriptor

Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/home/ico/web2py/gluon/rocket.py", line 1268, in run
    conn = Connection(*conn)
  File "/home/ico/web2py/gluon/rocket.py", line 105, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [Errno 9] Bad file descriptor

Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/home/ico/web2py/gluon/rocket.py", line 1268, in run
    conn = Connection(*conn)
  File "/home/ico/web2py/gluon/rocket.py", line 105, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [Errno 9] Bad file descriptor

Exception in thread Thread-5:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/home/ico/web2py/gluon/rocket.py", line 1268, in run
    conn = Connection(*conn)
  File "/home/ico/web2py/gluon/rocket.py", line 105, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [Errno 9] Bad file descriptor

Exception in thread Thread-6:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/home/ico/web2py/gluon/rocket.py", line 1268, in run
    conn = Connection(*conn)
  File "/home/ico/web2py/gluon/rocket.py", line 105, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [Errno 9] Bad file descriptor

Exception in thread Thread-7:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/home/ico/web2py/gluon/rocket.py", line 1268, in run
    conn = Connection(*conn)
  File "/home/ico/web2py/gluon/rocket.py", line 105, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [Errno 9] Bad file descriptor

Exception in thread Thread-9:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/home/ico/web2py/gluon/rocket.py", line 1268, in run
    conn = Connection(*conn)
  File "/home/ico/web2py/gluon/rocket.py", line 105, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [Errno 9] Bad file descriptor

Exception in thread Thread-10:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/home/ico/web2py/gluon/rocket.py", line 1268, in run
    conn = Connection(*conn)
  File "/home/ico/web2py/gluon/rocket.py", line 105, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [Errno 9] Bad file descriptor

Exception in thread Thread-11:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/home/ico/web2py/gluon/rocket.py", line 1268, in run
    conn = Connection(*conn)
  File "/home/ico/web2py/gluon/rocket.py", line 105, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [Errno 9] Bad file descriptor

Exception in thread Thread-8:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/home/ico/web2py/gluon/rocket.py", line 1268, in run
    conn = Connection(*conn)
  File "/home/ico/web2py/gluon/rocket.py", line 105, in __init__
    self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [Errno 9] Bad file descriptor

Dave S

unread,
Jun 25, 2019, 3:52:33 PM6/25/19
to web2py-users


On Tuesday, June 25, 2019 at 10:04:39 AM UTC-7, icodk wrote:
Now I tried both another Windows 10 machine and ubuntu with similar errors
As you can see bellow I used port 8000 on liniux because using port 443 gave the following error:

ERROR:Rocket.Errors.Port443:Socket 0.0.0.0:443 in use by other process and it won't share.
WARNING:Rocket.Errors.Port443:Listener started when not ready.

However, netstat didn't revile any process using 443 and nc could listen on this port 
$ sudo nc -l  -p 443


and receive connections from another machine (telnet 192.168.1.223 443)



Well, I've used all my rounds.  I have run Rocket on port 443, but that was with a 2.15.4 version on AWS Linux.   And when I renewed the certificates, I got something messed up, couldn't figure it out, and so I finished the move to Nginx.  I don't think Rocket has had many changes, although the Python3 effort may have had to touch it some.

I have not tried 443 on Windows (just 8000, 8080, 8800, ...), and I have not tried the Nginx Windows port (I believe it is still marked "experimental").

As a relatively easy choice of alternate technology, you can do a real simple Node.js server that echos your request.  Mercurial includes a webserver (might not be stand-alone on Windows) and I believe it's in the standard release package, just waiting to be turned on.

Good luck!

/dps

icodk

unread,
Jun 25, 2019, 5:35:12 PM6/25/19
to web2py-users
Appreciate your effort to help me, tahnks. I  use  Rocket as development server, and it served me well with python2 and web2py up to 2.17.1.
Production runs with nginx with ssl on aws. I thought  I will try to upgrade my app to python3 and 2.18.5 and the easyest would be Rocket. I will try it with http but it is not optimal for me because I have some IoT devices that
use https.
Wished somebody could help because it is part of the core functionality of web2py development (IMHO) and one of the things that make web2py development so easy to get up and running. 

黄祥

unread,
Jun 25, 2019, 7:05:28 PM6/25/19
to web2py-users
another way around if you want to stick with rocket, and want ssl, think you can use another web server to serve it as reverse proxy (nginx, apache, etc)
web2py also can be run with another server with anyserver.py, but not sure if it's accept the certificate parameter when execute it

best regards,
stifan

Dave S

unread,
Jun 26, 2019, 5:14:32 AM6/26/19
to web2py-users


On Tuesday, June 25, 2019 at 2:35:12 PM UTC-7, icodk wrote:
Appreciate your effort to help me, tahnks. I  use  Rocket as development server, and it served me well with python2 and web2py up to 2.17.1.
Production runs with nginx with ssl on aws. I thought  I will try to upgrade my app to python3 and 2.18.5 and the easyest would be Rocket. I will try it with http but it is not optimal for me because I have some IoT devices that
use https.
Wished somebody could help because it is part of the core functionality of web2py development (IMHO) and one of the things that make web2py development so easy to get up and running. 


Perhaps you should test 2.18.5 with Python2.  It might be the Python3 libraries that are the stumbling block. 

/dps

icodk

unread,
Jun 26, 2019, 5:37:47 PM6/26/19
to web2py-users
The whole point for me  is to prepare my app to python3 that seems to be the default on newer virtual machines on AWS and others.
I am sure it can run with 2.18.5.
If anybody on this forum managed to run web2py 2.18.5, python3 and Rocket without errors, please let me know.

Dave S

unread,
Jun 26, 2019, 9:23:08 PM6/26/19
to web2py-users


On Wednesday, June 26, 2019 at 2:37:47 PM UTC-7, icodk wrote:
The whole point for me  is to prepare my app to python3 that seems to be the default on newer virtual machines on AWS and others.
I am sure it can run with 2.18.5.
If anybody on this forum managed to run web2py 2.18.5, python3 and Rocket without errors, please let me know.




Actually, I think I have, using one of Nico's packages (not the latest, a couple months ago).  I didn't do any heavy testing, but requests seemed to work, it was the py3-n-my-code that was the biggest issue (especially print statements, which have to be commented, turned to print() calls, or tuned to logger() calls.

I've tried 2 different simple-minded apps, and only ran http:, not ess.

/dps


 

Carlos Lopez

unread,
Apr 25, 2021, 4:31:09 PM4/25/21
to web2py-users
Hi, I stumbled upon the same problem.
Using Version 2.20.4-stable+timestamp.2020.05.02.22.03.36
This problem only happens using Google chrome. If I use Firefox, there is no issue at all.
I could find a possible solution here:
Indeed I tried it, and worked. Maybe this should be applied to the rocket.py code. If you want, I can create a pull request.

Best regards.
Reply all
Reply to author
Forward
0 new messages