Edgewall Software
Modify

Opened 9 years ago

Closed 9 years ago

#12155 closed defect (fixed)

mod_python.version is not version string on mod_python 3.5

Reported by: tonarer@… Owned by: Jun Omae
Priority: normal Milestone: 1.0.9
Component: web frontend/mod_python Version: 1.0.8
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fix Internal Error page crashing with mod_python 3.5.

API Changes:
Internal Changes:

Description

Since updated from 1.0.6 ⇒ 1.0.8 Attachment does not work

Apache log

PythonHandler trac.web.modpython_frontend: AttributeError: 'module' object has no attribute 'replace', referer: http://server.simplesestudio.com.br/trac/entouragelab/attachment/ticket/2/?action=new

Attachments (1)

ass.png (97.4 KB ) - added by renato <tonarer@…> 9 years ago.

Download all attachments as: .zip

Change History (17)

comment:1 by anonymous, 9 years ago

Full Log

[Thu Aug 06 08:02:15.622505 2015] [:error] [pid 18785] [client 177.98.71.33:63103] PythonHandler trac.web.modpython_frontend:   File "/usr/lib64/python2.7/site-packages/mod_python/apache.py", line 398, in HandlerDispatch\n    result = obj(req), referer: http://server.simplesestudio.com.br/trac/entouragelab/attachment/ticket/2/?action=new
[Thu Aug 06 08:02:15.622688 2015] [:error] [pid 18785] [client 177.98.71.33:63103] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/modpython_frontend.py", line 148, in handler\n    gateway.run(dispatch_request), referer: http://server.simplesestudio.com.br/trac/entouragelab/attachment/ticket/2/?action=new
[Thu Aug 06 08:02:15.622749 2015] [:error] [pid 18785] [client 177.98.71.33:63103] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/wsgi.py", line 92, in run\n    response = application(self.environ, self._start_response), referer: http://server.simplesestudio.com.br/trac/entouragelab/attachment/ticket/2/?action=new
[Thu Aug 06 08:02:15.622803 2015] [:error] [pid 18785] [client 177.98.71.33:63103] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/main.py", line 519, in dispatch_request\n    return _dispatch_request(req, env, env_error), referer: http://server.simplesestudio.com.br/trac/entouragelab/attachment/ticket/2/?action=new
[Thu Aug 06 08:02:15.622856 2015] [:error] [pid 18785] [client 177.98.71.33:63103] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/main.py", line 558, in _dispatch_request\n    send_internal_error(env, req, sys.exc_info()), referer: http://server.simplesestudio.com.br/trac/entouragelab/attachment/ticket/2/?action=new
[Thu Aug 06 08:02:15.622909 2015] [:error] [pid 18785] [client 177.98.71.33:63103] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/main.py", line 659, in send_internal_error\n    description_en = get_description(lambda s, **kw: safefmt(s, kw)), referer: http://server.simplesestudio.com.br/trac/entouragelab/attachment/ticket/2/?action=new
[Thu Aug 06 08:02:15.622961 2015] [:error] [pid 18785] [client 177.98.71.33:63103] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/main.py", line 623, in get_description\n    for k, v in env.get_systeminfo()), referer: http://server.simplesestudio.com.br/trac/entouragelab/attachment/ticket/2/?action=new
[Thu Aug 06 08:02:15.623012 2015] [:error] [pid 18785] [client 177.98.71.33:63103] PythonHandler trac.web.modpython_frontend:   File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/main.py", line 623, in <genexpr>\n    for k, v in env.get_systeminfo()), referer: http://server.simplesestudio.com.br/trac/entouragelab/attachment/ticket/2/?action=new
[Thu Aug 06 08:02:15.623063 2015] [:error] [pid 18785] [client 177.98.71.33:63103] PythonHandler trac.web.modpython_frontend: AttributeError: 'module' object has no attribute 'replace', referer: http://server.simplesestudio.com.br/trac/entouragelab/attachment/ticket/2/?action=new

comment:2 by Jun Omae, 9 years ago

Component: generalattachment
Summary: Attachment File 1.0.8"Attach file" on ticket page doesn't work with Trac 1.0.8
Version: 1.0.8

Stack trace from comment:1.

  File "/usr/lib64/python2.7/site-packages/mod_python/apache.py", line 398, in HandlerDispatch
    result = obj(req)
  File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/modpython_frontend.py", line 148, in handler
    gateway.run(dispatch_request)
  File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/wsgi.py", line 92, in run
    response = application(self.environ, self._start_response)
  File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/main.py", line 519, in dispatch_request
    return _dispatch_request(req, env, env_error)
  File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/main.py", line 558, in _dispatch_request
    send_internal_error(env, req, sys.exc_info())
  File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/main.py", line 659, in send_internal_error
    description_en = get_description(lambda s, **kw: safefmt(s, kw))
  File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/main.py", line 623, in get_description
    for k, v in env.get_systeminfo())
  File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/main.py", line 623, in <genexpr>
    for k, v in env.get_systeminfo())
AttributeError: 'module' object has no attribute 'replace'

Could you please post the following?

  • Internal Server Error: … with stack trace in your trac.log file after TracLogging is enabled. That error is logged with Internal Server Error: .
  • System Information and Installed Plugins from "About Trac" page in your Trac.

comment:3 by renato <tonarer@…>, 9 years ago

logging	log_file	trac.log
log_format	
log_level	DEBUG
log_type	none
milestone	stats_provider	DefaultTicketGroupStatsProvider

But i could not find the file i'm on an multi-trac env

Apache is

LoadModule python_module /usr/local/apache/modules/mod_python.so

<Location /trac>
    SetHandler mod_python
    PythonInterpreter main_interpreter
    PythonHandler trac.web.modpython_frontend
    PythonOption TracEnvParentDir /trac
    PythonOption TracUriRoot /trac
    AuthType Basic
   AuthName "Rede Desenvolvimento"
   AuthUserFile /srv/user
   Require valid-user
</Location>
Last edited 9 years ago by Jun Omae (previous) (diff)

comment:4 by renato <tonarer@…>, 9 years ago

Trac[amt:session] DEBUG: Retrieving session for ID u'renato'
Trac[amt:main] ERROR: Internal Server Error:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/main.py", line 551, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/main.py", line 244, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/attachment.py", line 529, in process_request
    data = self._do_save(req, attachment)
  File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/attachment.py", line 782, in _do_save
    attachment.insert(filename, upload.file, size)
  File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/attachment.py", line 330, in insert
    os.makedirs(dir)
  File "/usr/lib64/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/lib64/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: 13 Permissão negada
Last edited 9 years ago by Jun Omae (previous) (diff)

comment:5 by renato <tonarer@…>, 9 years ago

Chmod -rf 777 /usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/

And now new log

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/main.py", line 551, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/web/main.py", line 244, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/attachment.py", line 529, in process_request
    data = self._do_save(req, attachment)
  File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/attachment.py", line 782, in _do_save
    attachment.insert(filename, upload.file, size)
  File "/usr/lib/python2.7/site-packages/Trac-1.0.8-py2.7.egg/trac/attachment.py", line 330, in insert
    os.makedirs(dir)
  File "/usr/lib64/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/lib64/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: 13 Permissão negada

comment:6 by Jun Omae, 9 years ago

Please post System Information and Installed Plugins from "About Trac" page in your Trac. I consider that one of ISystemInfoProvider components wrongly returns module instance instead of version string.

It seems that your $ENV/files directory is writable from Apache. Make sure that the $ENV/files directory is readable and writable from Apache.

Last edited 9 years ago by Jun Omae (previous) (diff)

by renato <tonarer@…>, 9 years ago

Attachment: ass.png added

comment:7 by renato <tonarer@…>, 9 years ago

File has been attached to you see

when you say $ENV/files you say trac-env dir ?

/trac/asdddasa?

in reply to:  7 comment:8 by Jun Omae, 9 years ago

File has been attached to you see

Thanks!

when you say $ENV/files you say trac-env dir ?

/trac/asdddasa?

Yeah. $ENV/file directory means files directory in directory of your Trac Environment.

comment:9 by renato <tonarer@…>, 9 years ago

Working fine now, chmod 777 when i migrated from the one server to another get lost on files folder

Thanks for the help i'm not a linux expert ! sorry

comment:10 by renato <tonarer@…>, 9 years ago

Resolution: fixed
Status: newclosed

in reply to:  6 comment:11 by Jun Omae, 9 years ago

Replying to jomae:

Please post System Information and Installed Plugins from "About Trac" page in your Trac. I consider that one of ISystemInfoProvider components wrongly returns module instance instead of version string.

I found root cause of that issue. The version variable is renamed to mp_version in mod_python module, in https://github.com/grisha/mod_python/commit/b5d9472c437edf06232f0d3a6500c959e17497c7#diff-717482277127bd065ed935e7b183bdd2.

Could you please apply the following patch and post screenshot of About Trac page?

  • trac/web/modpython_frontend.py

    diff --git a/trac/web/modpython_frontend.py b/trac/web/modpython_frontend.py
    index 60daa8998..6dc25355e 100644
    a b except ImportError:  
    2929
    3030from mod_python import apache
    3131try:
    32     from mod_python import version
     32    try:
     33        from mod_python import mp_version as version  # 3.5 and later
     34    except ImportError:
     35        from mod_python import version
    3336except ImportError:
    3437    version = "< 3.2"
    3538

comment:12 by renato <tonarer@…>, 9 years ago

But for what its working fine

in reply to:  12 comment:13 by Jun Omae, 9 years ago

Component: attachmentweb frontend/mod_python
Milestone: 1.0.9
Resolution: fixed
Status: closedreopened

Replying to renato <tonarer@…>:

But for what its working fine

Please post screenshot of "About Trac" page after the patch.

comment:14 by Jun Omae, 9 years ago

Owner: set to Jun Omae
Status: reopenedassigned

I'll push the patch in comment:11 after I confirm with mod_python 3.3 and 3.5.

comment:15 by Jun Omae, 9 years ago

Summary: "Attach file" on ticket page doesn't work with Trac 1.0.8mod_python.version is not version string on mod_python 3.5

comment:16 by Jun Omae, 9 years ago

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

Committed in [14229] and merged to trunk in [14230].

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.