Opened 16 years ago

Closed 16 years ago

#6595 closed defect (fixed)

Slave backend not reconnecting on socket loss, QTimer/threads related

Reported by: Jeff Lu <jll544@…> Owned by: danielk
Priority: critical Milestone: 0.22
Component: MythTV - General Version: head
Severity: high Keywords: win32 qtimer
Cc: Ticket locked: no

Description

Running trunk r20649, Qt4.4.3:

When my slave backend loses its connection to the master backend, the slave console shows "QObject::startTimer: timers cannot be started from another thread" and the slave never tries to reconnect.

The relevant threads appear to be MainServer and MythSocketThread. When the socket closes, MythSocketThread calls a member function in MainServer that tries to start the masterServerReconnect Qtimer.

But apparently Qt enforces the Qtimer/thread relationship differently on win32 vs. linux (both Qt4.4.3). On linux, the existing code works - timer is started and the slave reconnects. On win32, the error prints, and the timer does not start.

The attached patch corrects this issue on win32 by emitting a signal instead of starting the timer. I've seen other cases of similar Qtimer/thread errors on win32, so I'd be interested in knowing if there are other/better ways to fix this.

Attachments (2)

6595-mainserver-qtimer.patch (1.4 KB ) - added by Jeff Lu <jll544@…> 16 years ago.
6595-v1.patch (3.6 KB ) - added by danielk 16 years ago.
possible fix

Download all attachments as: .zip

Change History (7)

by Jeff Lu <jll544@…>, 16 years ago

comment:1 by danielk, 16 years ago

Milestone: unknown0.22
Priority: minorcritical
Severity: mediumhigh

I don't like the patch, but this problem needs to be addressed before the 0.22 release.

comment:2 by stuartm, 16 years ago

Owner: changed from Isaac Richards to danielk
Status: newassigned

by danielk, 16 years ago

Attachment: 6595-v1.patch added

possible fix

comment:3 by danielk, 16 years ago

Status: assignedinfoneeded

Jeff, can you test the attached patch and let me know if this solves the problem as well?

in reply to:  3 comment:4 by Jeff Lu <jll544@…>, 16 years ago

Replying to danielk:

Jeff, can you test the attached patch and let me know if this solves the problem as well?

Yes, the patch does fix this problem. Thanks!

comment:5 by danielk, 16 years ago

Resolution: fixed
Status: infoneededclosed

(In [21547]) Fixes #6595. Apply slightly modified version of the patch. This just sends a local message to the event loop to start the reconnect timer instead of calling it directly. Because calling it directly does not always work in Qt4.

Note: See TracTickets for help on using tickets.