Opened 10 years ago

Closed 10 years ago

#124 closed defect (wontfix)

QSynth makes CPU load 99.9%

Reported by: komh Owned by:
Priority: major Milestone: Qt Enhanced
Component: General Version: 4.5.1 GA
Severity: low Keywords:
Cc: komh@…

Description

Hi/2.

I've ported QSynth, which is a front-end of fluidsynth.

BTW when I launching QSynth, CPU load is 99.9% all the time even though I don't do anything.

What should I provide you with to analyze this problem ?

Change History (19)

comment:1 Changed 10 years ago by dmik

Please prepare a zip that contains all the involved sources, headers and libraries so that I can rebuild it locally -- then I will be able to look at the problem. You may download the zip to ftp://ftp.dmik.org/incoming.

comment:2 Changed 10 years ago by komh

  • Cc komh added

Hi/2.

Something changed with 4.5.1GA. But 99.9 problem still exist.

  1. click '+' button on bottom-left corner
  2. click 'Soundfonts' tab
  3. click 'Open' button
  4. Click 'Computer'
  5. Now CPU load peaks to 99.9


I've uploaded to your incoming directory.

comment:3 Changed 10 years ago by dmik

Seems that you simply sent me a source zip while I asked for a complete pack (including the required fluidsynth library or how it's called) that just builds given I only have gcc and Qt4. Sorry, I don't have the autoconf environment and such and don't have time to set it all up.

Anyway this seems to be a known problem: the current QFileSystemWatcher implementation uses the polling method which will certainly give you this delay if there are a lot of files (50-100)in the current directory. See #6.

Please try to reduce the number of files in the CWD and report back.

comment:4 follow-up: Changed 10 years ago by dmik

Okay, I see that fluidsynth is pre-built so I may actually adjust qsynth.pro.in manually and try to build. But still please try to experiment with the number of files on your side.

comment:5 in reply to: ↑ 4 Changed 10 years ago by komh

Thanks for your efforts.

It's regardless of the numbers of files.

When I click 'Computer', just drives should be displayed. This causes CPU load to peak to 99.9 ?

Anyway I'll try again with reduced files.

BTW, cc seems not to work. I cannot received any notification email. hmm...

comment:6 follow-up: Changed 10 years ago by diver

  • Cc komh@… added; komh removed

cc works now?

comment:7 follow-up: Changed 10 years ago by dmik

Does it ever drop the CPU load to normal if you don't do anything? Does it drop if you select anything else but Computer? What happens if you just dismiss the file dialog?

comment:8 in reply to: ↑ 6 Changed 10 years ago by komh

Replying to diver:

cc works now?

Ok. Thanks.

comment:9 in reply to: ↑ 7 ; follow-up: Changed 10 years ago by komh

Replying to dmik:

Does it ever drop the CPU load to normal if you don't do anything? Does it drop if you select anything else but Computer?

If I do so, CPU load is not high. But subdirs are not displayed for a long time. After a long time, about 30 seconds ?, subdir are displayed. And CPU load peaks to 99.9.

What happens if you just dismiss the file dialog?

Once CPU load peaks to 99.9, QSynth does not respond even though I dismiss the file dialog. I should kill it with Watch Cat.

comment:10 in reply to: ↑ 9 Changed 10 years ago by komh

Replying to komh:

Replying to dmik:

Does it ever drop the CPU load to normal if you don't do anything? Does it drop if you select anything else but Computer?

If I do so, CPU load is not high. But subdirs are not displayed for a long time. After a long time, about 30 seconds ?, subdir are displayed. And CPU load peaks to 99.9.

What happens if you just dismiss the file dialog?

Once CPU load peaks to 99.9, QSynth does not respond even though I dismiss the file dialog. I should kill it with Watch Cat.

Ah, this is regardless of the numbers of files.

comment:11 Changed 10 years ago by dmik

Just to clarify: does it ever give 99% CPU load if you don't go to My Computer in the file dialog?

comment:12 Changed 10 years ago by komh

Yes. Just waiting causes CPU load to 99.9 after about 30 seconds.

comment:13 Changed 10 years ago by dmik

This is probably not related to the file dialog at all; I will try to compile and run it locally.

comment:14 Changed 10 years ago by dmik

BTW, please try the current trunk if possible. There was a number of fixes that *might* be related.

comment:15 Changed 10 years ago by komh

Ok, I'll try.

BTW you cannot reproduce this problem ?

comment:16 Changed 10 years ago by komh

Ok. I've confirmed this is not a issue related to 'File Dialog'.

Instead, it's a problem of QSocketNotifier for stdout/stderr.

When I disable this feature, QSynth works as expected.

comment:17 Changed 10 years ago by dmik

I see, good that you found it. Do you think it's a specific bug of Qt for OS/2? If so, could you please give more details on that?

PS. I didn't manage to compile QSynth locally due to being busy with other tasks ATM.

comment:18 Changed 10 years ago by komh

Maybe true for Win32 as well.

The following is the codes which I disabled.

#if !defined(WIN32) && !defined(Q_OS_OS2)
	// Check if we can redirect our own stdout/stderr...
	if (m_pOptions->bStdoutCapture && ::pipe(g_fdStdout) == 0) {
		::dup2(g_fdStdout[QSYNTH_FDWRITE], STDOUT_FILENO);
		::dup2(g_fdStdout[QSYNTH_FDWRITE], STDERR_FILENO);
		m_pStdoutNotifier = new QSocketNotifier(
			g_fdStdout[QSYNTH_FDREAD], QSocketNotifier::Read, this);
		QObject::connect(m_pStdoutNotifier,
			SIGNAL(activated(int)),
			SLOT(stdoutNotifySlot(int)));
	}
#endif

and

// Own stdout/stderr socket notifier slot.
void qsynthMainForm::stdoutNotifySlot ( int fd )
{
#if !defined(WIN32) && !defined(Q_OS_OS2)
	char achBuffer[1024];
	int  cchBuffer = ::read(fd, achBuffer, sizeof(achBuffer) - 1);
	if (cchBuffer > 0) {
		achBuffer[cchBuffer] = (char) 0;
		appendStdoutBuffer(achBuffer);
	}
#endif
}

comment:19 Changed 10 years ago by dmik

  • Resolution set to wontfix
  • Status changed from new to closed

I found the exact reason for the freeze. Please see http://svn.netlabs.org/qt4/ticket/119#comment:17. In other words, it's not a Qt bug.

Note: See TracTickets for help on using tickets.