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

Thread stuck in self.__queue.get() #25

Open
odedfos opened this issue Jun 19, 2016 · 1 comment
Open

Thread stuck in self.__queue.get() #25

odedfos opened this issue Jun 19, 2016 · 1 comment

Comments

@odedfos
Copy link

odedfos commented Jun 19, 2016

I have a multi-threaded program in which threads call a function decorated with the timeout-decorator:

@timeout_decorator.timeout(seconds=300, use_signals=False)
def some_func(param1, param2):
    ...

Occasionally one of the threads hangs even though the function (some_func) returns successfully.

This happens after a successful function call when trying to dequeue the result in self.__queue.get():

    @property
    def value(self):
        """Read-only property containing data returned from function."""
        if self.ready is True:
            flag, load = self.__queue.get()
            if flag:
                return load
            raise load

It did not reproduce locally, only on prod environment where I used gdb to see what was going on.
Going over the timeout code, I could not figure out what would cause this condition.

Perhaps the library is not thread safe?
Any other idea what could cause this behavior?

As a safety mechanism perhaps you should set the self.__queue.get() to be non blocking
self.__queue.get_nowait()

@odedfos
Copy link
Author

odedfos commented Jun 19, 2016

I now see that pull request 24 provides this functionality.
Will you be merging it anytime soon?

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

No branches or pull requests

1 participant