Edgewall Software
Modify

Opened 4 years ago

Closed 4 years ago

#13403 closed defect (fixed)

Trac 1.5.3 with Apache+fcgi and Python 3.8.10 doesn't work

Reported by: bobben@… Owned by: Jun Omae
Priority: normal Milestone: 1.5.4
Component: web frontend Version: 1.5.3
Severity: normal Keywords: fcgi
Cc: Branch:
Release Notes:

Make fcgi frontend compatible with Python 3.

API Changes:
Internal Changes:

Description (last modified by Jun Omae)

Hi!

Just tried Trac 1.5.3 which is supposed to run on Python 3.5+ but I can't get it to work.

Running track-admin works fine, such as these commands:

sudo trac-admin /www/trac upgrade
sudo trac-admin /www/trac wiki upgrade
sudo trac-admin /www/trac deploy /www/trac/deploy
sudo trac-admin /www/trac repository resync '*'

But the front-end won't work.

I get this error in my Apache logs:

Content-Type: text/plain

 Oops...

Trac detected an internal error:

No module named 'dummy_thread'

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/trac/web/_fcgi.py", line 53, in <module>
    import thread
ModuleNotFoundError: No module named 'thread'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/WebServer/CGI-Executables/trac.fcgi", line 33, in <module>
    from trac.web import fcgi_frontend
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/trac/web/fcgi_frontend.py", line 51, in <module>
    from ._fcgi import WSGIServer
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/trac/web/_fcgi.py", line 57, in <module>
    import dummy_thread as thread
ModuleNotFoundError: No module named 'dummy_thread'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/WebServer/CGI-Executables/trac.fcgi", line 47, in <module>
    tb = io.Bytes()
AttributeError: module 'io' has no attribute 'Bytes'
[Tue May 11 00:02:50.663862 2021] [:warn] [pid 11858:tid 123145536704512] mod_fcgid: error reading data, FastCGI server closed connection
[Tue May 11 00:02:50.663958 2021] [:error] [pid 11858:tid 123145536704512] End of script output before headers: trac.fcgi

So I Googled and found that you could create a thread.py file (with some content) in the site-packages directory which fixed the problem "no module named 'thread'", but then I got this error message instead:

Content-Type: text/plain

 Oops...

Trac detected an internal error:

'OSError' object is not subscriptable

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/trac/web/_fcgi.py", line 987, in _setupSocket
    sock.getpeername()
OSError: [Errno 57] Socket is not connected

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/WebServer/CGI-Executables/trac.fcgi", line 34, in <module>
    fcgi_frontend.run()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/trac/web/fcgi_frontend.py", line 54, in run
    WSGIServer(dispatch_request, **params).run()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/trac/web/_fcgi.py", line 1064, in run
    sock = self._setupSocket()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/trac/web/_fcgi.py", line 989, in _setupSocket
    if e[0] == errno.ENOTSOCK:
TypeError: 'OSError' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/WebServer/CGI-Executables/trac.fcgi", line 47, in <module>
    tb = io.Bytes()
AttributeError: module 'io' has no attribute 'Bytes'
[Mon May 10 23:18:28.531449 2021] [:warn] [pid 11858:tid 123145537777664] mod_fcgid: error reading data, FastCGI server closed connection
[Mon May 10 23:18:28.531739 2021] [:error] [pid 11858:tid 123145537777664] End of script output before headers: trac.fcgi

I am using the latest trac.fcgi from installation of Trac 1.5.3, which points to the Python 3.8 binary and the trac.fcgi file has execute permissions for the 'www' user of Apache.

Some googling suggested that the error 'End of script output' and Apache error 500 is because of insufficient execute permissions of the trac.fcgi in the cgi-bin for Apache.

Used 'r-x------' (500) for user 'www' successfully with Python 2.7 and Trac 1.4.2, but even tried 'r-x--x--x' (511) with this new version, but doesn't help.

I'm currently running Apache 2.4.46, mod_fcgid 2.3.9, subversion 1.14.1 and Python 3.8.10 on macOS 10.13.6.

Kind regards Pär

Attachments (0)

Change History (4)

comment:1 by Jun Omae, 4 years ago

Description: modified (diff)
Keywords: fcgi added
Milestone: 1.5.4
Owner: set to Jun Omae
Status: newassigned

Thanks for the reporting! I try to confirm the issue and fix it.

comment:2 by Jun Omae, 4 years ago

Proposed changes in [b469a4f7d/jomae.git] (jomae.git@t13403). Tested on Apache 2.4 with mod_fcgid.

comment:3 by bobben@…, 4 years ago

Yep, that fixed it, thanks!

comment:4 by Jun Omae, 4 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed in [17541].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.