Modify

#10870 closed defect (fixed)

ERROR: Exception caught while checking for upgrade

Reported by: alillards Owned by: falkb
Priority: normal Component: SimpleMultiProjectPlugin
Severity: normal Keywords:
Cc: rjollos, hasienda, jun66j5 Trac Release: 0.12

Description

Hi!

First of all, thanks for your efforts making this plugin possible, you are doing a great job!

I have a little problem: After having installed the plugin, I noticed a 3-4 second delay in every TRAC page refresh in my browser. After discarding apache or network problems, I checked the TRAC logs and got this:

2013-02-13 11:07:39,817 Trac[env] ERROR: Exception caught while checking for upgrade: 
Traceback (most recent call last):
  File "build/bdist.linux-i686/egg/trac/env.py", line 664, in open_environment
    needs_upgrade = env.needs_upgrade()
  File "build/bdist.linux-i686/egg/trac/env.py", line 498, in needs_upgrade
    if participant.environment_needs_upgrade(db):
  File "build/bdist.linux-i686/egg/simplemultiproject/environmentSetup.py", line 78, in environment_needs_upgrade
    print "SimpleMultiProject database schema version: %s initialized." % db_version
IOError: sys.stdout access restricted by mod_wsgi
2013-02-13 11:07:39,848 Trac[api] WARNING: Discarding duplicate repository 'mine'

If I try to upgrade the db I get this response:

# trac-admin /TRAC_PATH/ upgrade
SimpleMultiProject database schema version: 4 initialized.
SimpleMultiProject database schema version: 4 installed.
SimpleMultiProject database schema is out of date: False
Database is up to date, no upgrade necessary.

Apart from that, the plugin works ok, but the lag is so annoying the team asks me daily to remove it. Can you please help?

Thanks!

Attachments (1)

t10870-r12666.diff (2.5 KB) - added by jun66j5 19 months ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 19 months ago by falkb

Seems, WSGI blocks the print function for several seconds, doesn't it? Please, try to comment out that line in the sources and regenerate your .egg file again with

python setup.py clean bdist_egg

Did this help?

comment:2 Changed 19 months ago by alillards

  • Resolution set to fixed
  • Status changed from new to closed

Looks right, I disabled it (in the wsgi module), and works fine now.

In case someone needs it, what I did was add the following lines to /etc/httpd/conf.d/wsgi.conf:

WSGIRestrictStdout Off
WSGIRestrictStdin Off

Thanks a lot for your help falkb!

comment:3 follow-up: Changed 19 months ago by falkb

  • Cc rjollos hasienda jun66j5 added

Excuse me, does anybody know what the right way is to print such messages to console?

comment:4 in reply to: ↑ 3 Changed 19 months ago by jun66j5

Excuse me, does anybody know what the right way is to print such messages to console?

No way. environment_needs_upgrade() shouldn't use print statement because the method is called from not only trac-admin but also httpd server. If it use, this issue will occurs. Use self.log instead.

And, upgrade_environment() and environment_created() should use trac.util.text.printout and printerr instead of print. These methods converts unicode string to the encoding of console.

Patch, t10870-r12666.diff, here (untested, sorry).

Changed 19 months ago by jun66j5

comment:5 Changed 19 months ago by falkb

  • Resolution fixed deleted
  • Status changed from closed to reopened

Thanks a lot for this patch! I'm going to apply and test it these days.

comment:6 Changed 19 months ago by falkb

  • Owner changed from crossroad to falkb
  • Status changed from reopened to new

comment:7 Changed 19 months ago by falkb

  • Resolution set to fixed
  • Status changed from new to closed

(In [12674]) fixed #10870: applied patch of jun66j5

  • reviewed upgrade
  • proper usage of console print to prevent access probs and timeouts with mod_wsgi

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.