Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Monitors in Reactor seem to accumulate for IO Objects indefinitely (until actor dies or is terminated) #118

Open
monolar opened this issue Oct 7, 2014 · 2 comments

Comments

@monolar
Copy link

monolar commented Oct 7, 2014

It seems that the reactor used in the celluloid-io mailbox only ever creates monitors (and keeps those references in @monitors).

The assignment happens here: https://github.com/celluloid/celluloid-io/blob/master/lib/celluloid/io/reactor.rb#L49

I am however unable to find that those monitors are ever cleaned up again for a given io object.

Specifically i am trying to deal with a new TCPSocket which fails on initialize. This is used for having one actor establishing a connection to some remote host and reconnecting by itself (without letting the actor die!) and reestablishing a new connection.

I tried, naively, to approach this by having some sort of 'unwait' mechanism telling the reactor to stop monitoring an io resource: https://github.com/monolar/celluloid-io/commit/ede7cda79a56af699d3710b3645c5f85ab1dce1f

The cleanup not happeing has the main problem of file-descriptors leaking and the secondary problem of socket objects remaining referenced (by the reactor) leading to them not being GC'd.

@tarcieri
Copy link
Member

tarcieri commented Oct 7, 2014

Looks like this was introduced in a4e953c (cc @halorgium)

A hash isn't really the right solution here. We should be able to track the state of all monitors via the reactor itself.

I would suggest reverting a4e953c for now. There will still be sporadic brokenness around simultaneous read/write interests, but at least programs won't leak file descriptors.

@HoneyryderChuck
Copy link

This has been solved in 0.16.1, or am I mistaken?

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

No branches or pull requests

4 participants