Edgewall Software
Modify

Opened 12 years ago

Closed 12 years ago

#10790 closed defect (cantfix)

trac-admin crash with MemoryError in do_initenv

Reported by: shakaran@… Owned by:
Priority: normal Milestone:
Component: admin/console Version: 1.0dev
Severity: normal Keywords: do_initenv memoryerror trac-admin
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I am using lastest develoment version following http://trac.edgewall.org/wiki/TracInstall and I cannot create a project. The machine has 8 GB of ram and it only uses 2 GB usually.

This is Traceback:

# easy_install Trac==dev
Searching for Trac==dev
Reading http://pypi.python.org/simple/Trac/
Reading http://trac.edgewall.org/
Reading http://trac.edgewall.org/wiki/TracDownload
Reading http://trac.edgewall.com/
Reading http://projects.edgewall.com/trac
Reading http://projects.edgewall.com/trac/wiki/TracDownload
Best match: Trac dev
Downloading http://svn.edgewall.org/repos/trac/trunk#egg=Trac-dev
Doing subversion checkout from http://svn.edgewall.org/repos/trac/trunk to /tmp/easy_install-Pe0qv1/trunk
Processing trunk
Writing /tmp/easy_install-Pe0qv1/trunk/setup.cfg
Running setup.py -q bdist_egg --dist-dir /tmp/easy_install-Pe0qv1/trunk/egg-dist-tmp-_9XeZO
Removing Trac 0.12.3 from easy-install.pth file
Adding Trac 1.0dev-r11161 to easy-install.pth file
Installing trac-admin script to /usr/local/bin
Installing tracd script to /usr/local/bin

Installed /usr/local/lib/python2.7/site-packages/Trac-1.0dev_r11161-py2.7.egg
Processing dependencies for Trac==1.0dev-r11161
Finished processing dependencies for Trac==1.0dev-r11161

# trac-admin /home/myuser/dev/trac initenv
Creating a new Trac environment at /home/myuser/dev/trac

Trac will first ask a few questions about your environment 
in order to initialize and prepare the project database.

 Please enter the name of your project.
 This name will be used in page titles and descriptions.

Project Name [My Project]> myproject
 
 Please specify the connection string for the database to use.
 By default, a local SQLite database is created in the environment
 directory. It is also possible to use an already existing
 PostgreSQL database (check the Trac documentation for the exact
 connection string syntax).

Database connection string [sqlite:db/trac.db]> 

Creating and Initializing Project
Initenv for '/home/myuser/dev/trac' failed. 
Failed to create environment.

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/Trac-1.0dev_r11161-py2.7.egg/trac/admin/console.py", line 437, in do_initenv
    options=options)
  File "/usr/local/lib/python2.7/site-packages/Trac-1.0dev_r11161-py2.7.egg/trac/core.py", line 124, in __call__
    self.__init__(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/Trac-1.0dev_r11161-py2.7.egg/trac/env.py", line 267, in __init__
    self.create(options)
  File "/usr/local/lib/python2.7/site-packages/Trac-1.0dev_r11161-py2.7.egg/trac/env.py", line 551, in create
    self.setup_config()
  File "/usr/local/lib/python2.7/site-packages/Trac-1.0dev_r11161-py2.7.egg/trac/env.py", line 585, in setup_config
    load_components(self, plugins_dir and (plugins_dir,))
  File "/usr/local/lib/python2.7/site-packages/Trac-1.0dev_r11161-py2.7.egg/trac/loader.py", line 114, in load_components
    loadfunc(env, search_path, auto_enable=plugins_dir)
  File "/usr/local/lib/python2.7/site-packages/Trac-1.0dev_r11161-py2.7.egg/trac/loader.py", line 70, in _load_eggs
    _log_error(entry, e)
  File "/usr/local/lib/python2.7/site-packages/Trac-1.0dev_r11161-py2.7.egg/trac/loader.py", line 59, in _log_error
    exception_to_unicode(e, traceback=True))
  File "/usr/local/lib/python2.7/site-packages/Trac-1.0dev_r11161-py2.7.egg/trac/util/text.py", line 83, in exception_to_unicode
    traceback_only = get_last_traceback().split('\n')[:-2]
  File "/usr/local/lib/python2.7/site-packages/Trac-1.0dev_r11161-py2.7.egg/trac/util/__init__.py", line 422, in get_last_traceback
    traceback.print_exc(file=tb)
  File "/usr/local/lib/python2.7/traceback.py", line 232, in print_exc
    print_exception(etype, value, tb, limit, file)
  File "/usr/local/lib/python2.7/traceback.py", line 125, in print_exception
    print_tb(tb, limit, file)
  File "/usr/local/lib/python2.7/traceback.py", line 69, in print_tb
    line = linecache.getline(filename, lineno, f.f_globals)
  File "/usr/local/lib/python2.7/linecache.py", line 14, in getline
    lines = getlines(filename, module_globals)
  File "/usr/local/lib/python2.7/linecache.py", line 40, in getlines
    return updatecache(filename, module_globals)
  File "/usr/local/lib/python2.7/linecache.py", line 128, in updatecache
    lines = fp.readlines()
MemoryError

Attachments (0)

Change History (5)

comment:1 by Remy Blank, 12 years ago

This is a secondary error that happens while Trac tries to format an exception that happened while loading a module. Could you please try and change line 59 of trac/loader.py to set traceback=False? This will prevent the traceback from being built, and should at least give us the exception message. You will need to work with an extracted version of the code instead of an egg.

You can also try disabling all plugins and see if the issue persists. If it doesn't, re-enable plugins one by one until you find the one that generates the exception.

comment:2 by shakaran@…, 12 years ago

Changing the line on /usr/local/lib/python2.7/site-packages/Trac-1.0dev_r11161-py2.7.egg/trac/loader.py

It shows now:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/Trac-1.0dev_r11161-py2.7.egg/trac/admin/console.py", line 437, in do_initenv
Initenv for '/home/myuser/dev/trac' failed. 

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/Trac-1.0dev_r11161-py2.7.egg/trac/admin/console.py", line 441, in do_initenv
MemoryError:

comment:3 by Remy Blank, 12 years ago

Ah, so the primary error is also a MemoryError. No luck.

Did you try disabling plugins? If this is reproducible without any plugins, then you'll have to search outside of Trac, because it's working fine for everyone else. Do you have any per-process memory limits?

Please also post on the MailingList, other people may have seen such a failure.

comment:4 by shakaran@…, 12 years ago

No plugins. It is a base installation.

Installing as root it works. As normal user no, but I should, it have all the write permissions and make a MemoryError is weird.

As normal user the limits are:

ulimit -a
core file size          (blocks, -c) 200000
data seg size           (kbytes, -d) 200000
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 73728
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) 200000
open files                      (-n) 100
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 35
virtual memory          (kbytes, -v) 200000
file locks                      (-x) unlimited

As root user:

# ulimit -a
core file size          (blocks, -c) 1000000
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 73728
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 4096
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 14335
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

I am using cPanel that enable shell fork bomb protection on shared hosting. I am root on the machine, but my shared hosting users not, so for the max memory size I have to change in:

/etc/profile.d/limits.sh 
/etc/bashrc
/etc/profile

I change the lines:

if [ "$LIMITUSER" != "root" ]; then
        ulimit -n 100 -u 35 -m 200000 -d 200000 -s 8192 -c 200000 -v 200000 2>/dev/null
else

By:

if [ "$LIMITUSER" != "root" ]; then
        ulimit -n 100 -u 35 -m unlimited -d 200000 -s 8192 -c 200000 -v 200000 2>/dev/null
else

I login again, check with ulimit -m and it shows unlimited for a normal user. I run again for create a project. Same result as normal user a MemoryError, but with root it works.

I need know the specification for run trac-admin as regular user with a base installation.

in reply to:  4 comment:5 by Remy Blank, 12 years ago

Resolution: cantfix
Status: newclosed

Replying to shakaran@…:

I need know the specification for run trac-admin as regular user with a base installation.

Unfortunately, we don't have that, and it's probably dependent on many factors like the precise versions of Python, all dependencies and the DB backend you use.

So this is definitely an InstallationIssue. This Trac is for bugs in Trac itself. For support, please use the MailingList and IrcChannel. Thank you.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) 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.