Ticket #3781 (closed defect: fixed)
Sometimes Trac install crashes on Windows at startup
| Reported by: | pkou at ua.fm | Owned by: | cboos |
|---|---|---|---|
| Priority: | high | Milestone: | 0.10 |
| Component: | general | Version: | 0.10rc1 |
| Severity: | critical | Keywords: | |
| Cc: |
Description
Environment: Clean Trac install from source:/trunk@3787 on Windows XP and typical CGI configuration via Apache 2.0.55.
Problem: The system crashes while accessing Trac with the following details:
Oops...
Trac detected an internal error: 'module' object has no attribute 'fcntl'
Traceback (most recent call last):
File "C:/Program Files/Apache Group/Apache2/cgi-bin/trac.cgi", line 20, in ?
cgi_frontend.run()
File "C:\Python23\Lib\site-packages\trac\web\cgi_frontend.py", line 55, in run
flags = fcntl.fcntl(fd, fcntl.F_GETFL)
AttributeError: 'module' object has no attribute 'fcntl'
Reason: The specified place is protected from not existing modules using ImportError. However, it is not protected from the cases when the specific module exists but it does not have the required symbols.
Solution is proposed in the following patch:
-
trac/web/cgi_frontend.py
54 54 fd = stream.fileno() 55 55 flags = fcntl.fcntl(fd, fcntl.F_GETFL) 56 56 fcntl.fcntl(fd, fcntl.F_SETFL, flags & ~os.O_NONBLOCK) 57 except ImportError:57 except (ImportError, AttributeError): 58 58 pass 59 59 60 60 try: # Use binary I/O on Windows 61 61 import msvcrt 62 62 msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) 63 63 msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) 64 except ImportError:64 except (ImportError, AttributeError): 65 65 pass 66 66 67 67 gateway = CGIGateway() -
trac/web/_fcgi.py
948 948 # Attempt to glean the maximum number of connections 949 949 # from the OS. 950 950 maxConns = resource.getrlimit(resource.RLIMIT_NOFILE)[0] 951 except ImportError:951 except (ImportError, AttributeError): 952 952 maxConns = 100 # Just some made up number. 953 953 maxReqs = maxConns 954 954 if multiplexed:
Attachments
Change History
Note: See
TracTickets for help on using
tickets.


