Heap corruption when printing, if importing pytorch *before* julia
- Dominant language
- Python
- Stars
- 893
- Forks
- 101
- PR merge metrics
- No merged PRs in 30d
Description
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:
```python
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:
```python
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:
```python
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?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.