Fixed an issue with a readline from socket in bpd #40

Merged
merged 2 commits into from Jun 4, 2012

Projects

None yet

2 participants

@djrtl

in several situations I got a crash due to having the strip() called on a None object. This simple change should solve that.

Regards,
Matteo

@sampsyo
beetbox member

There are a couple of slight problems with this change:

  • First, readline() should never return None. If this is happening, the root cause of this bug is elsewhere (probably in bluelet) and this change just hides it. (This is not such a big deal; it's good to have a fix even if we don't know the root cause.)
  • More importantly, this is supposed to skip the line if it is whitespace-only. So there needs to be another conditional (if not line: break) after it is stripped.

Fair enough.
I got this crash several times after bluelet reported a "error: [Errno 104] Connection reset by peer", which I thought was a legitimate exception after all (the problem seemingly on the client side).
Let me know what you think about it, in the meantime I'll add the second check.

@sampsyo sampsyo merged commit e634b95 into beetbox:master Jun 4, 2012
@sampsyo sampsyo added a commit that referenced this pull request Jun 4, 2012
@sampsyo sampsyo changelog note for BPD crash (GH-40) 01fe599
@sampsyo
beetbox member

Awesome; thanks for the fix! Meanwhile, I'll continue trying to figure out what's going wrong inside Bluelet...

@djrtl djrtl pushed a commit to djrtl/beets-dj that referenced this pull request Jan 6, 2013
@sampsyo sampsyo changelog note for BPD crash (GH-40) bb3cb66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment