Opened 15 years ago

Closed 15 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@…> 15 years ago.
6595-v1.patch (3.6 KB) - added by danielk 15 years ago.
possible fix

Download all attachments as: .zip

Change History (7)

Changed 15 years ago by Jeff Lu <jll544@…>

comment:1 Changed 15 years ago by danielk

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 Changed 15 years ago by stuartm

Owner: changed from Isaac Richards to danielk
Status: newassigned

Changed 15 years ago by danielk

Attachment: 6595-v1.patch added

possible fix

comment:3 Changed 15 years ago by danielk

Status: assignedinfoneeded

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

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

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 Changed 15 years ago by danielk

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.