-
Notifications
You must be signed in to change notification settings - Fork 21
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
[WIP] - Libuv 1.0 Support #59
base: master
Are you sure you want to change the base?
Conversation
5771c0d
to
9d6e66d
Compare
This change modifies the uv_fs_read() function signature slightly by adding a new $offset parameter. This allows the same file handle to be reused for multiple reads. Previously the only way to access a section of a file that had already been read was to open a new handle. Old: uv_fs_read(resoruce $loop, zval $fd, long $length, callable $callback) New: uv_fs_read(resoruce $loop, zval $fd, long $offest, long $length, callable $callback) This change represents a minor BC break for existing code using uv_fs_read().
…ainfiles or php related streams resolving a SIGABRT as epoll doesn't support those stream types
64cc8fe
to
f2052a3
Compare
This issue is rather strange, so I am documenting it here. The following code works fine with no segfaults.
However this code, which performs the same functionality except inside a class causes a segfault on php_shutdown.
Removing the uv_unref call fixes the issue with the above. Code should be updated so that it does not segfault. Stack trace:
|
This segfault isn't surprising. You're manually decrementing the reference count for the timer resource from one to zero inside your callback and this leads to the actual UV resource being cleared:
This is fine in your procedural code because there are no other references to the timer resource that need to be garbage collected. But your class example is storing a reference to the timer resource inside the In short, you're only asking for trouble if you start fiddling with refcounts in userland. Just call Honestly, unless someone has a compelling reason to expose Anybody else have thoughts on this? |
@rdlowrey I owe you a beer my friend. I have been trying to track this down for several days. Removing the zend_list_delete calls in uv_unref fixes the segfaulting issues as these are cleared in destruct_uv and destruct_uv_loop - this allows for proper cleanup with libuv 1.0. I'll check this in shortly, thanks sooooo much! |
@steverhoades no problem man; I appreciate your efforts to bring the extension up to 1.0 compatibility! 👍 |
…freed by destruct_uv
libuv 1.0 has been officially released: joyent/libuv@feb2a9e |
@rdlowrey @steverhoades Thank you! this patch is awesome!
Hmm, This is my fault. I'd like to merge this and fix this problem later. I suppose libuv 1.0 brings big worth for us. |
@chobie Yeah I realized later that the buffer was stored there. I've since fixed this locally and have been using it to great effect. I'll try to update my PR with the working changes this week. |
@rdlowrey fantastic! I haven't had any time recently to continue to look into this further however it's still something I would like to get done. Let me know if there is anything I can do to help. |
Updates are based on the migration guide:
https://github.com/joyent/libuv/blob/a4f88760be1838603fe2eae89a651066cc42eedd/docs/src/migration_010_100.rst
There are still some segfault/segabrt issues that i am trying to get re-produceable tests in place for, leaving this here so that those with more experience can provide feedback.