Opened 13 years ago

Closed 12 years ago

#2614 closed defect (fixed)

MythNews crash when news URL is incorrect

Reported by: otto at kolsi dot fi Owned by: paulh
Priority: minor Milestone: 0.21
Component: mythnews Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

If one of the news sites in MythNews? contains wrong URL (the host part, e.g. www.something.com -> www1.something.com) and user presses couple of times (within 1-2 seconds) the RETRIEVENEWS button, MythNews? crashes with SIGSEGV. Crashing thread is in QSocket::connectToHost().

I've attached both frontend log with -v all and gdb backtrace.

Attachments (2)

mythfrontend.log (13.1 KB) - added by otto at kolsi dot fi 13 years ago.
Frontend log with -v all
gdb.txt (12.3 KB) - added by otto at kolsi dot fi 13 years ago.
gdb backtrace

Download all attachments as: .zip

Change History (8)

Changed 13 years ago by otto at kolsi dot fi

Attachment: mythfrontend.log added

Frontend log with -v all

Changed 13 years ago by otto at kolsi dot fi

Attachment: gdb.txt added

gdb backtrace

comment:1 Changed 13 years ago by stuartm

Milestone: unknown0.21
Owner: changed from Isaac Richards to stuartm

comment:2 Changed 12 years ago by stuartm

The attached backtrace doesn't really help at all. It sounds like a race condition and I might stumble across a fix by trying a few things and crossing my fingers but I don't have mythnews installed or the time to do it.

You could try moving stop() from the end of NewsSite::slotFinished to the top. Or a more likely fix would be to block repeated calls to site->retrieve() while m_RetrieveTimer->isActive() or using another block flag.

MythNews::slotRetrieveNews is a little strange, it loops through the list of sites three times and calls site->stop() on each site twice (see cancelRetrieve()). One loop connects the NewsSite::finished signal, but retrieve isn't called until we reach the second loop. We also connect that signal every time the function is called and never disconnect it which I think has the potential to get very, very messy (single signal resulting in a slot be called several times over).

comment:3 in reply to:  2 Changed 12 years ago by otto at kolsi dot fi

Replying to stuartm:

You could try moving stop() from the end of NewsSite::slotFinished to the top. Or a more likely fix would be to block repeated calls to site->retrieve() while m_RetrieveTimer->isActive() or using another block flag.

Tried to move the stop() but that didn't help. Also tried to play a bit with m_RetrieveTimer->isActive() and use it to block repeated calls, but without success. I'm not familiar with this signaling stuff so have to leave this to someone who can figure out what's going one.

One further note to anyone trying to reproduce this: crash occurs when pressing several times RETRIEVENEWS button iff user has beforehand pressed right so that news article section is active/focused (not the lefthand news-site list).

comment:4 Changed 12 years ago by stuartm

Owner: changed from stuartm to Isaac Richards

Ok, well I can't figure out what's going wrong here, so I'm putting it back into the pool.

comment:5 Changed 12 years ago by paulh

Owner: changed from Isaac Richards to paulh

comment:6 Changed 12 years ago by paulh

Resolution: fixed
Status: newclosed

(In [14376]) Fix a long standing problem in MythNews? were when trying to retrieve news articles from an unreachable URL it would more often than not cause a segfault. The actual fix is to not call QUrlOperator::stop() inside the finished() slot it's not needed anyway.

Also fixes a memory leak and cleans up connecting to some of the signals to make sure we only connect to each signal once.

Fixes #2614.

Note: See TracTickets for help on using tickets.