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

Core dump from PyChapel when returning string #81

Open
buddha314 opened this issue Aug 8, 2017 · 4 comments
Open

Core dump from PyChapel when returning string #81

buddha314 opened this issue Aug 8, 2017 · 4 comments

Comments

@buddha314
Copy link

buddha314 commented Aug 8, 2017

This seems rather "dramatic"...

call.py

import os
from pych.extern import Chapel
currentloc = os.path.dirname(os.path.realpath(__file__))

@Chapel(sfile=os.path.join(currentloc + '/response.chpl'))
def flip_bit():
    return str

if __name__=="__main__":
    w = flip_bit()
    print(w)

and response.chpl

export
proc flip_bit() :string {
  var m : string = "no way";
  return m;
}

Yields the rather impressive error:

> python call.py
Segmentation fault (core dumped)

This is probably the least work I've ever had to do to cause a core dump. Kinda proud of myself right now.

BTW: This was on the way to sending in a string to be manipulated and returned. So that will be my NEXT ticket if you have advice.

@buddha314
Copy link
Author

I tried going the other way around, just passing a string in to chpl and I get this error

call.py

import os
from pych.extern import Chapel

currentloc = os.path.dirname(os.path.realpath(__file__))

@Chapel(sfile=os.path.join(currentloc + '/response.chpl'))
def flip_bit(msg=str):
    return None
if __name__=="__main__":
    w = flip_bit('your mama')

with response.chpl

export
proc flip_bit(in msg: string) {
   writeln(msg);
}

producing

> python call.py
/tmp/temp-40P_GZ.chpl:2: error: Out of memory allocating "_ic_these__ref_list_BaseArr"

@lydia-duncan
Copy link
Member

Well, I knew returning strings wouldn't be supported, but we should really just error when we don't understand the type instead of reaching that point :(

@lydia-duncan
Copy link
Member

lydia-duncan commented Aug 9, 2017

Verified that the argument example also gives the same error for me. I tried removing the "in" intent and it ended up freezing my machine for 10-15 minutes before I forcibly rebooted. I intend to try again on a different box to see if I can get it to run to completion or kill it in a kinder manner.

@lydia-duncan
Copy link
Member

With the in intent removed from the argument, we still get an out of memory error, but at a different location:
/tmp/temp-wEn84y.chpl:3: error: Cannot allocate memory in channel.write(a:string, b:ioNewline)

Modified response.chpl:

export
proc flip_bit(msg: string) {
  writeln(msg);
}

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

No branches or pull requests

2 participants