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

Failure with polling client in MPD network code #781

Closed
adamcik opened this Issue Jul 14, 2014 · 3 comments

Comments

3 participants
@adamcik
Member

adamcik commented Jul 14, 2014

while sleep 1; do mpc status; done manages to trigger:

Traceback (most recent call last):
  File "/home/adamcik/dev/mopidy/mopidy/utils/network.py", line 272, in recv_callback
    self.disable_recv()
  File "/home/adamcik/dev/mopidy/mopidy/utils/network.py", line 236, in disable_recv
    gobject.source_remove(self.recv_id)
TypeError: an integer is required

@adamcik adamcik added the MPD label Jul 14, 2014

@jodal jodal added the bug label Jul 18, 2014

@jodal

This comment has been minimized.

Member

jodal commented Jul 18, 2014

Can't reproduce in 10 minutes of running the while loop.

@trygveaa

This comment has been minimized.

Member

trygveaa commented Aug 6, 2014

I can reproduce this with:
while true; do mpc next; done

I can't see any consistency in when it happens, but it happens fairly often. Often after 20-50 iterations, sometimes more.

I can't seem to reproduce this with the status command.

@trygveaa trygveaa self-assigned this Aug 13, 2014

@trygveaa trygveaa added this to the v0.19.4 milestone Aug 13, 2014

trygveaa added a commit to trygveaa/mopidy that referenced this issue Aug 13, 2014

network: disable_recv before telling actor to close connection
As of d62ad96, when the connection can't receive more data from the
client, it tells the actor to stop the connection and calls
disable_recv(). The actor operates in it's own thread and when it stops
the connection, disable_recv is being called again from a different
thread. Since the actor is told to stop the connection before
disable_recv is called, the two calls to disable_recv may happen
simultaneously.

This causes a race condition issue where both threads can reach past the
check that recv_id is not None before either of them set it to None. If
one of them set it to None before the other one tries to use it, an
error is raised.

This commit calls disable_recv before telling the actor to stop the
connection. Since disable_recv is a blocking call, this ensures that
recv_id is being set to None before the actor thread begins to stop the
connection.

Fixes mopidy#781
@jodal

This comment has been minimized.

Member

jodal commented Aug 29, 2014

Hopefully fixed with the merge of PR#827.

@jodal jodal closed this Aug 29, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment