Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heap corruption when printing, if importing pytorch *before* julia #499

Open
MilesCranmer opened this issue May 29, 2022 · 0 comments
Open

Comments

@MilesCranmer
Copy link
Collaborator

I have no idea what this very strange issue comes from. It could be a combination of my specific torch version (tested 1.11-1.13, still occurs), specific operating system (macOS), specific python version (3.8.9) combined with my specific julia version (1.7.2).

Here's a minimal example:

import torch
from julia import Pkg
Pkg.add("StatsBase")

The output is:

Python(61891,0x100598580) malloc: *** error for object 0xffffffff00000000: pointer being freed was not allocated
Python(61891,0x100598580) malloc: *** set a breakpoint in malloc_error_break to debug

signal (6): Abort trap: 6
in expression starting at none:0
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Allocations: 11431809 (Pool: 11423282; Big: 8527); GC: 14
[1]    61891 abort      ~/venvs/main/bin/ipython

However, I can make this go away with:

from julia import Pkg
import torch
Pkg.add("StatsBase")

This works fine.

I see this more helpful error when I run this code in a debugger:

File ~/venvs/main/lib/python3.8/site-packages/julia/core.py:621, in Julia.eval(self, src)
    619 if src is None:
    620     return None
--> 621 ans = self._call(src)
    622 if not ans:
    623     return None

File ~/venvs/main/lib/python3.8/site-packages/julia/core.py:549, in Julia._call(self, src)
    547 # logger.debug("_call(%s)", src)
    548 ans = self.api.jl_eval_string(src.encode('utf-8'))
--> 549 self.check_exception(src)
    551 return ans

File ~/venvs/main/lib/python3.8/site-packages/julia/core.py:603, in Julia.check_exception(self, src)
    601 else:
    602     exception = sprint(showerror, self._as_pyobj(res))
--> 603 raise JuliaError(u'Exception \'{}\' occurred while calling julia code:\n{}'
    604                  .format(exception, src))

JuliaError: Exception 'IOError: pipe_open: file already exists (EEXIST)' occurred while calling julia code:

So it seems like perhaps pytorch is taking over one of the pipes for printing from Python?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant