Re: [pypy-dev] Crashes with rffi

2014-11-13 Thread Armin Rigo
Hi Timothy, I did a git checkout of the branch async-io-file; then "cd pixie/pixie/vm/libs/test"; then "touch README.md" (unsure how you're supposed to run from the top directory); then: PYTHONPATH=~/git/pixie:~/pypysrc python -m unittest test_uv_file It seems to work for me (Ran 2 tests in

Re: [pypy-dev] Crashes with rffi

2014-11-10 Thread Timothy Baldridge
The plot thickens even more. I tried several other things, and was surprised to find that a call to uv_timeout works just fine, that call takes a callback, but no strings and never stores the strings internally. On a whim I translated the entire thing (without a JIT) and everything I throw at it r

Re: [pypy-dev] Crashes with rffi

2014-11-10 Thread Timothy Baldridge
So I hacked on this more over my lunch break and am still completely stumped, I've removed all deallocation in order to make sure I'm not double-freeing something (make it stop crashing then make it stop leaking is the idea). No dice. The only thing I can figure out is that perhaps rffi is somehow

Re: [pypy-dev] Crashes with rffi

2014-11-10 Thread Timothy Baldridge
That could be true for uv_fs_read, but in the minimal test case (in my last email) I'm only opening a file 10 times, after the first few iterations of opening the file (2-3 times) that test crashes. Timothy On Mon, Nov 10, 2014 at 7:52 AM, Armin Rigo wrote: > Hi Timothy, > > We're talking past

Re: [pypy-dev] Crashes with rffi

2014-11-10 Thread Armin Rigo
Hi Timothy, We're talking past each other. I think that I already found that your code is not correct according to the docs. You need to fix the signature of uv_fs_read() and create an array 'uv_buf_t[]', possibly of length 1. I may be wrong though. A bientôt, Armin.

Re: [pypy-dev] Crashes with rffi

2014-11-10 Thread Timothy Baldridge
So I think I've narrowed it down a bit to this: it seems to only happen when I can one of these libuv functions for the second time. The second test in this file throws the exception: https://github.com/pixie-lang/pixie/blob/async-io-file/pixie/vm/libs/test/test_uv_file.py#L20 " https://github.com

Re: [pypy-dev] Crashes with rffi

2014-11-09 Thread Armin Rigo
Hi Timothy, From the docs, the signature of uv_fs_read() is this (http://docs.libuv.org/en/latest/fs.html#c.uv_fs_read): int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file file, const uv_buf_t bufs[], unsigned int nbufs, int64_t offset, uv_fs_cb cb) This seems to differ from what you're repor

Re: [pypy-dev] Crashes with rffi

2014-11-09 Thread Maciej Fijalkowski
you should really use "with" sentence with scoped buffers, otherwise you're leaking memory. Same goes for lltype.malloc(flavor='raw'), you need to lltype.free it. I don't think that causes crashes though, I would need to take a deeper look into the incantation too. How do I get a crash? Is there a

[pypy-dev] Crashes with rffi

2014-11-09 Thread Timothy Baldridge
So I'm trying to integrate libuv into Pixie, and all was going well, but I'm hitting a bit of a snag when it comes to opening files. I've tried several things, but my latest iteration is this: https://github.com/pixie-lang/pixie/blob/async-io-file/pixie/vm/libs/uv_file.py#L104 When running this i