[Zope] RE: [Zope-CMF] no mem for new parser

Norman Khine khine@btinternet.com
Sat, 28 Apr 2001 17:16:44 +0100


Hello Tres,
Thanks fo your reply, you say my system is running out of memory, do you
mean Hard Disk Space, RAM or what? I am with iServer, and they have
allocated me 400Mb of HDD and I have only used about 150Mb -- I'll check
though.

I can also confirm that I have not done any changes to the code.

I also had this error on my screen

2001-04-28T15:40:43 ERROR(200) ZServer uncaptured python exception, closin
g channel <select-trigger (pipe) at 82e956c> (exceptions.MemoryError:
[/usr/home
/khine/usr/local/Zope/ZServer/medusa/asyncore.py|poll|83]
[/usr/home/khine/usr/l
ocal/Zope/ZServer/medusa/asyncore.py|handle_read_event|335]
[/usr/home/khine/usr
/local/Zope/ZServer/medusa/select_trigger.py|handle_read|77]
[/usr/home/khine/us
r/local/Zope/ZServer/medusa
[/usr/home/khine/usr/local/Zop
e/ZServer/medusa/asyncore.p

and on the zope I get this

Error Type: MemoryError
Error Value: Out of memory while compressing data

Traceback (innermost last):
  File /usr/home/khine/usr/local/Zope/lib/python/ZPublisher/Publish.py, line
223, in publish_module
  File /usr/home/khine/usr/local/Zope/lib/python/ZPublisher/Publish.py, line
187, in publish
  File /usr/home/khine/usr/local/Zope/lib/python/Zope/__init__.py, line 221,
in zpublisher_exception_hook
    (Object: ApplicationDefaultPermissions)
  File /usr/home/khine/usr/local/Zope/lib/python/ZPublisher/Publish.py, line
171, in publish
  File /usr/home/khine/usr/local/Zope/lib/python/ZPublisher/mapply.py, line
160, in mapply
    (Object: manage_contents)
  File /usr/home/khine/usr/local/Zope/lib/python/ZPublisher/Publish.py, line
112, in call_object
    (Object: manage_contents)
  File
/usr/home/khine/usr/local/Zope/lib/python/Shared/DC/Scripts/Bindings.py,
line 324, in __call__
    (Object: manage_contents)
  File
/usr/home/khine/usr/local/Zope/lib/python/Shared/DC/Scripts/Bindings.py,
line 354, in _bindAndExec
    (Object: manage_contents)
  File /usr/home/khine/usr/local/Zope/lib/python/App/special_dtml.py, line
236, in _exec
    (Object: manage_contents)
  File /usr/home/khine/usr/local/Zope/lib/python/DocumentTemplate/DT_In.py,
line 721, in renderwob
    (Object: objectItems)
  File /usr/home/khine/usr/local/lib/python2.0/string.py, line 129, in join
MemoryError:

And then the server restarts.

Can you confirm as to what you want me to do on the DirectoryView.py file --
where the following lines are, which I found on the file,

 	   if self.data is None or changed:
         try:
                self.data, self.objects = self.prepareContents(registry,
                    register_subdirs=changed)
            except:
                # DEBUG
                import traceback
                traceback.print_exc()

                self.data = {}
                self.objects = ()
        return self.data, self.objects

you want me to change it to:

try:
        self.data = data = self.prepareContents(registry,
            register_subdirs=changed)
    except:
        # DEBUG
        import traceback
        traceback.print_exc()

        raise


Thanks

Norman

-----Original Message-----
From: tres [mailto:tres]On Behalf Of Tres Seaver
Sent: 28 April 2001 15:56
To: Norman Khine
Cc: Zope-CMF
Subject: Re: [Zope-CMF] no mem for new parser


Norman Khine wrote:
>
> Hello I just gort this error and the server crashed.
>
> My set up
> Zope version: Zope 2.3.2b2 (source release, python 1.5.2, linux2)
> Python version: 2.0 (#2, Jan 8 2001, 16:54:34) [GCC 2.95.2 19991024
> (release)]
> System Platform: freebsd4
>
> no mem for new parser
> Traceback (most recent call last):
>   File
> "/usr/home/khine/usr/local/Zope/lib/python/Products/CMFCore/DirectoryView
> .py", line 198, in getContents
>
> Any suggestions will be most appreciated

Hmm, the relevant bits of getContents are (both for CMF 1.0 and
the head of the CVS repository)::

    # CMFCore/DirectoryView.py, line #97
    try:
        self.data = data = self.prepareContents(registry,
            register_subdirs=changed)
    except:
        # DEBUG
        import traceback
        traceback.print_exc()

I can't see how that code could *possibly* yield the traceback
you post -- did you trim it at all?  At any rate, that code is
broken;  having caught the exception in order to print it, it
doesn't re-raise it.  For the nonce, please try adding

         raise

just below the last line of the snippet.

I find that error message deep in the bowels of the Python
2.0 C source::

  # $PYTHON_2/Parser/parsetok.c, line #81
  static node *
  parsetok(struct tok_state *tok, grammar *g, int start
          , perrdetail *err_ret)
  {
      parser_state *ps;
      node *n;
      int started = 0;

      if ((ps = PyParser_New(g, start)) == NULL) {
          fprintf(stderr, "no mem for new parser\n");
          err_ret->error = E_NOMEM;
          return NULL;
  }

So, it looks like your system is running out of memory, but
the DirectoryView suppresses the error, and hence you get a core
dump.

Please submit a tracker issue for this problem:

  http://www.zope.org/Products/PTK/Tracker

Do note your version of Python on the issue -- that was most
helpful for tracking down the source of the exception.

Tres.
--
===============================================================
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org