On Fri, Aug 12, 2016 at 11:59:00PM -0700, Andi Vajda wrote:
> > 
> > and it still crashes. Playing with -Xmx -Xms, -Xss doesn't help at all.
> > 
> > Any suggestions about cause of this and possible solution?
> 
> No one replied to your question so far. I don't have much to add since I
> have no access to your platform and can't reproduce any of this to debug it.
> It looks like the symptoms you describe could hint at a version mismatch
> between the headers you use to compile (and the libs to link) and then the
> ones you use at runtime. Maybe version skew or 32-bit vs 64-bit (?) or
> different frameworks.
> Sorry for not having anything more useful to say.
> 
> Andi..

Well. I'm pretty sure that this is not header/version mismatch. Because it
happens in isolated environment with only one JDK installed.

I've replaced jcc.__main__ entry point with wrapper that creates child
process and passes args to it via stdin instead of sys.argv and it works.

I was able to build pylucene with such wrapper and it passes all tests. So
I'm pretty sure that it's not header/binary mismatch. Because in such code
should crash somewhere else. 

>From my point of view it's stack size limit or something like this.

In any case thanks for you reply. I've working workaround. I know that
pylucene currently lacks development effort, so this probably will not be
fixed.

In any case if you have time and want to take a look, I can prepare qemu VM
that reproduces it. 

Code that I've used:

# Usage: replace jcc calls with wrapper call:
#
# Before:
#   python2.7 -m jcc.__main__ --jar file1.jar ... --build
#
# After:
#   debian/jcc_wrapper python2.7 -m jcc.__main__ --jar file1.jar ... --build
#
# jcc_wrapper will read all arguments from sys.argv, invoke itself with --stdin 
arg and
# pass parameters to JCC without touching of sys.argv

import os
import sys
import subprocess

if len(sys.argv) > 1 and sys.argv[1] == '--stdin':
    # Child process. Read options and call jcc
    args = sys.stdin.read().split('\n')
    
    # Get rid of -m jcc.__main__ (expected to be first two args)
    if len(args) > 2 and args[1] == '-m':
        del args[1:3]

    # python -m jcc fills sys.argv[0] with path to module. Emulate this
    import jcc
    args[0] = os.path.join(jcc.__path__[0], '__main__.py')

    from jcc import cpp
    cpp.jcc(args)
else:
    # parent process. Read opts, and pass them to child
    # expected args: jcc_wrapper python2.7 -m jcc.__main__ ...
    proc = subprocess.Popen([sys.argv[1], sys.argv[0], '--stdin'], 
stdin=subprocess.PIPE)
    proc.stdin.write('\n'.join(sys.argv[1:]))
    proc.stdin.close()
    sys.exit(proc.wait())

-- 
WBR, Dmitry

Reply via email to