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

Clear settings['updates']['callback'] in __wakeup #213

Closed
andris-zalitis opened this issue Oct 17, 2017 · 5 comments
Closed

Clear settings['updates']['callback'] in __wakeup #213

andris-zalitis opened this issue Oct 17, 2017 · 5 comments

Comments

@andris-zalitis
Copy link

I pass my object and function name to updates callback. Settings of MadelineProto are serialized. So when deserializing MadelineProto, it restores reference to object from previous session. Shouldn't we clear it?

I am having particular issue with this because I have pthreads module installed on my server (though I don't use pthreads in MadelineProto) and because of that, I sometimes get this error:

Uncaught RuntimeException: pthreads detected an attempt to connect to an object which has already been destroyed in ...
@andris-zalitis andris-zalitis changed the title Clear settings['updates']['callback'] on __wakeup Clear settings['updates']['callback'] in __wakeup Oct 17, 2017
@danog
Copy link
Owner

danog commented Oct 17, 2017

That error is not caused by the callback, but by (one or more) bugs in pthreads, the same bugs that prevent MadelineProto from being threaded: I can't find a way to reproduce them with separate code snippets, so I can't open a proper issue @ krakjoe/pthreads, and make them fix everything. Some help to help reproduce these bugs would sure be appreciated; for now, refer to #4

@danog danog closed this as completed Oct 17, 2017
@andris-zalitis
Copy link
Author

@danog

OK, disregarding pthreads, the question remains - shouldn't we clear the reference to updates callback object after deserialization?

@danog danog reopened this Oct 17, 2017
@danog
Copy link
Owner

danog commented Oct 17, 2017

Possibly, even if I can't find a reason for doing that.

@ghost
Copy link

ghost commented Oct 17, 2017

@danog Setting a new callback function(?)

@danog
Copy link
Owner

danog commented Feb 18, 2018

Serialization already throws an exception if we try to serialize a function callback, so clearing it on __wakeup is pointless.
Use static class methods as update callbacks.

@danog danog closed this as completed Feb 18, 2018
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