Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » MT assertion failed in IsST()
MT assertion failed in IsST() [message #9899] Thu, 07 June 2007 11:08 Go to next message
mezise is currently offline  mezise
Messages: 54
Registered: April 2006
Member
I have a problem solving this issue
ASSERT FAILED: Assertion failed in d:/upp705dev3/uppsrc/Core/Mt.h, line 53
Thread::IsST()

Could someone check my Thread implementation in an enclosed test package, please?

The test app downloads a text file through http and shows it in a DocEdit.

To reproduce the issue run the app in MINGW Debug, click on START button, then on STOP button always before download ends, then again on START, again on STOP and so on until error shows.

[My environment: Windows XP Professional SP2 x32, upp-mingw-705-dev3]

Michal

[Updated on: Fri, 08 June 2007 22:42]

Report message to a moderator

Re: MT assertion failed in IsST() [message #9906 is a reply to message #9899] Fri, 08 June 2007 09:29 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
A *nasty* bug in U++ ("Format" function, called in httpcli, initialized formatters, which can be done in ST mode only).

Now fixed.

Quick patch:

Core/Format.cpp 808:

static void sRegisterFormatters()
{
	ONCELOCK {
		IntDoubleRegister(BOOL_V);
		IntDoubleRegister(INT_V);
		IntDoubleRegister(INT64_V);
		IntDoubleRegister(DOUBLE_V);

		RegisterStringFormatter("s", &StringFormatter);
		RegisterNullFormatter("", &DateFormatter);
		RegisterFormatter(DATE_V, "", &DateFormatter);
		RegisterFormatter(TIME_V, "", &TimeFormatter);

		RegisterNumberFormatter("n",  &RealFormatter);
		RegisterNumberFormatter("ne", &RealFormatter);
		RegisterNumberFormatter("nf", &RealFormatter);
		RegisterNumberFormatter("nl", &RealFormatter);
		RegisterNumberFormatter("nle", &RealFormatter);
		RegisterNumberFormatter("nlf", &RealFormatter);
		RegisterNumberFormatter("v",  &RealFormatter);
		RegisterNumberFormatter("ve", &RealFormatter);
		RegisterNumberFormatter("vf", &RealFormatter);
		RegisterNumberFormatter("vl", &RealFormatter);
		RegisterNumberFormatter("vle", &RealFormatter);
		RegisterNumberFormatter("vlf", &RealFormatter);

		// real number formats (n = fixed decimals, v = valid decimals)
		// ne, ve - force exponential notation; nf, vf - force fixed notation; nl, vl - language-based formatting
		// Options: [+][[-]<digits>][!][^[+]<expdig>]
		// + .. always prepend sign
		// [-]<digits> .. number of decimals to print (negative = left of decimal point, default = 6)
		// ! .. keep insignificant zeros
		// ^ .. exponent options:
		// + .. always prepend sign to exponent
		// <expdig> exponent padding width

		RegisterNumberFormatter("a", &IntLowerAlphaFormatter);
		RegisterNumberFormatter("A", &IntUpperAlphaFormatter);
		RegisterNumberFormatter("r", &IntLowerRomanFormatter);
		RegisterNumberFormatter("R", &IntUpperRomanFormatter);

		RegisterValueFormatter("vt", &StdFormatFormatter);
		RegisterValueFormatter("", &StdFormatFormatter);
	}
}

INITBLOCK {
	sRegisterFormatters();
}

String NFormat(int language, const char *s, const Vector<Value>& v)
{
	sRegisterFormatters();
	Formatting f;
	f.language = language;
	String result;
	int pos = 0;
	const char *b;


Mirek
Re: MT assertion failed in IsST() [message #9915 is a reply to message #9899] Fri, 08 June 2007 13:58 Go to previous messageGo to next message
mezise is currently offline  mezise
Messages: 54
Registered: April 2006
Member
Thanks! Patch applied and issue solved but I encountered another 2 failed assertions. Unfortunately did not found a way to reproduce them (just various clicks between START and STOP buttons).
I do not know if it has something to do with MT.

Twise occured:
ASSERT FAILED: Assertion failed in d:/upp705dev3/uppsrc/Core/Vcont.h, line 17
i >= 0 && i < items


Once occured:
ASSERT FAILED: Assertion failed in d:\upp705dev3\uppsrc\CtrlLib\DocEdit.cpp, line 19
this->line.GetCount() == para.GetCount()


Michal

[Updated on: Fri, 08 June 2007 14:01]

Report message to a moderator

Re: MT assertion failed in IsST() [message #9917 is a reply to message #9915] Fri, 08 June 2007 15:45 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK, I quickly reviewed the code and...

void DownloadThread(CallerInfo caller)
{
	caller.app->isProgressCanceled = false;

	String result;
	result << "Download started, timeout is set to 30 seconds...";
	caller.app->downloadResult.Set(result);
	caller.app->tab.RefreshFrame();


is MT broken -> first, U++ does not allow to call GUI related things from other than the main thread (we the exception of callback queue). And even if it would, you would still need some mutex for caller.app.

Solution: Instead of calling caller.app methods directly, use callback queue; calling SetTimeCallback is legal at any moment (queue is serialized - there is mutex inside). Set the delay parameter = 0 so that it gets invoked at first oportunity.

Mirek
Re: MT assertion failed in IsST() [message #9922 is a reply to message #9899] Fri, 08 June 2007 19:18 Go to previous message
mezise is currently offline  mezise
Messages: 54
Registered: April 2006
Member
Thank you Mirek!
Now I realize the meaning of PostCallback function in reference/GuiMT. I shoud more carefully study examples.

Michal
Previous Topic: https - how to?
Next Topic: Again ReadMemoryBarrier() etc
Goto Forum:
  


Current Time: Sun Apr 28 01:17:09 CEST 2024

Total time taken to generate the page: 0.02505 seconds