Thread creation error not enough storage is available to process this command

← →csr ©   (2004-04-28 16:10) [0]

 
csr ©
 
(2004-04-28 16:10)
[0]

Что означает этот эррор и как его лечить?

Thread creation error: Not enough storage is available to process this command


 
Digitman ©
 
(2004-04-28 16:12)
[1]

ты поди влупил параметром в CreateThread бешеный размер требуемого потоку стека ?


 
Тимохов ©
 
(2004-04-28 16:13)
[2]

или это уже стотысячный по счету поток


 
panov ©
 
(2004-04-28 16:35)
[3]

>Тимохов ©   (28.04.04 16:13) [2]

Это уже миллионный поток для рассылки спамерских писем.

——————
SPAMERS MUST DIE.


 
Матлабист
 
(2004-04-28 16:35)
[4]

> Что означает этот эррор и как его лечить?
Код приведи что-ль…


 
csr ©
 
(2004-04-28 17:29)
[5]

Я использую класс TThread, по этому чвно не указываю размер стека… И в кол-ве потоков тут не проблема, т.к. подобные штуки и на большем кол-ве потоков работали… А тут… буквально 1500 потоков всего и такая вот ерунда получается… Не может поток даже стартануть. А если ставим скажем 1000 потоков, то пашет все ок… Может можно как-нить разобраться в чем дело?

2 Матлабист : Ты хочешь чтоб я тут привел код модуля потока?? ))


 
Тимохов ©
 
(2004-04-28 17:31)
[6]

а на фига столько?
1) спам
2) жизнь моделируете


 
csr ©
 
(2004-04-28 17:46)
[7]

2 Тимохов:
А какая разница? Мне поставили задачу — я пишу прогу, выполняю, то что мне сказали — мое дело малое… Сказали так сделать, вот и делааю…

Вы мне лучше подскажите конкретно по сабжу, пожалйста.


 
Игорь Шевченко ©
 
(2004-04-28 17:50)
[8]


> А тут… буквально 1500 потоков всего и такая вот ерунда
> получается

Дурацкое решение. Все процессорное время будет тратиться на переключение контекстов.


 
Smithson ©
 
(2004-04-28 17:51)
[9]

Конкретно по сабжу, на выбор:
1. Уменьшить число потоков
2. Уменьшить потребности каждого экземпляра потока в ресурсах (стек, память в куче, объекты системы)
3. Привести код (с комментариями), тогда возможно будет его проанализировать (если найдутся желающие) и подсказать пути оптимизации или решения этой же задачи другими средствами.
4. Ну или сидеть и думать самому.

Выбирай.


 
csr ©
 
(2004-04-28 17:52)
[10]

2 Игорь Шевченко
более умное решение можешь предложить? Проц атлон 3000 загружает на 30% максимум! Тут не в этом вопрос! Все написано ОК, но почему-то ошибка вылетает! Кто знает как пофиксить это??


 
csr ©
 
(2004-04-28 17:55)
[11]

2 Smithson ©

Вариант №2: Подскажи, как используя класс TThread Уменьшить потребности каждого экземпляра потока в ресурсах (стек, память в куче, объекты системы) ?


 
Smithson ©
 
(2004-04-28 17:58)
[12]

Это класс довольно экономно расходует реcурсы. Но ты-то используешь не TThread, а его потомка, про таланты и аппетиты которого нам по-прежнему ничего не известно.


 
csr ©
 
(2004-04-28 18:01)
[13]

2 Smithson ©

А уменьшить кол-во потоков — низя… Мне б наоборот достичь того чтоб увеличить их мона было ;)

И вот еще что: если в пределах одного процесса стартануть еще 1000 потоков (но уже другого назначения), то тож такой баг… А если несколько копий проги запустить, то все на 1000 потоках валят как надо )) Только правда проц умирает почти полностью…


 
csr ©
 
(2004-04-28 18:04)
[14]

2 Smithson ©
Дак создается он по дефолту — никаких значений размера стека и прочего я не менял…

Как это можнго сделать?


 
Игорь Шевченко ©
 
(2004-04-28 18:06)
[15]


> Мне б наоборот достичь того чтоб увеличить их мона было
> ;)

Можно вопрос ? Что за задача такая ?


 
Тимохов ©
 
(2004-04-28 18:07)
[16]


> Игорь Шевченко ©   (28.04.04 18:06) [15]

вам же сказал — какая вам разница


 
Smithson ©
 
(2004-04-28 18:12)
[17]

Да, я видимо не точно сформулировал свои пункты. По 1, 2 и 4 пункту возможно только самостоятельная работа. И только 3 пункт может стать основой для продолжения обсуждения.
:)
Удачи!


 
csr ©
 
(2004-04-28 18:36)
[18]

2 Smithson ©

Дак ты не знаешь как менять размер стека у потомков класса TThread ?


 
Тимохов ©
 
(2004-04-28 18:44)
[19]

в потомке tthread перекрыть конструктор (см. tthread.create)
в BeginThread вторым парметром передавать не 0, а другое значение.

почитать в MSDN про функцию createthread — я точно не помню — достаточно ли этого будет или нужно еще уменьшить размер стека у всего приложения.


 
Smithson ©
 
(2004-04-28 18:57)
[20]


constructor TThread.Create(CreateSuspended: Boolean);
var
 Flags: DWORD;
begin
 inherited Create;
 AddThread;
 FSuspended := CreateSuspended;
 Flags := 0;
 if CreateSuspended then Flags := CREATE_SUSPENDED;
 FHandle := BeginThread(nil, 0, @ThreadProc, Pointer(Self), Flags, FThreadID);
end;

0 — означает, что система сама оперирует стеком и выделяет столько, сколько нужно. Отсюда вывод — ты в своем потомке этого класса не жри так стек и он будет расходоваться экономнее.


 
Тимохов ©
 
(2004-04-28 18:59)
[21]


> 0 — означает, что система сама оперирует стеком и выделяет
> столько, сколько нужно

нет
размер берется из основной программы.


 
Тимохов ©
 
(2004-04-28 19:00)
[22]

чтобы быть корректным в терминах поправлю себя — из главного потока, а не из основной программы.


 
panov ©
 
(2004-04-28 19:02)
[23]

>Игорь Шевченко ©   (28.04.04 18:06) [15]

Дык вот ответ — http://www.caesar-soft.biz/


 
Smithson ©
 
(2004-04-28 19:03)
[24]

Ос, не знал. Считал, что система сама распределяет по страничке…
Спасибо.


 
Игорь Шевченко ©
 
(2004-04-28 19:09)
[25]

[23] panov ©   (28.04.04 19:02)

SPAMERS MUST DIE!!!

И как у людей совести хватает…


 
csr ©
 
(2004-04-28 21:16)
[26]

2 panov ©  

Ну что ты сайт-то светишь? Я щас не работаю там. Чего ты тут шорох наводишь? Не можешь ответить — вот и не отвечай.

Спасибо господа, я попробую с размером стека… Позже сообщу что получилось…


 
Игорь Шевченко ©
 
(2004-04-28 22:33)
[27]

csr ©   (28.04.04 21:16)


> Ну что ты сайт-то светишь?

Так ты его сам в анкете светишь. Нафиг спамеров, давить их, как тараканов. Тем более, многопоточных.


 
Юрий Зотов ©
 
(2004-04-28 23:44)
[28]

Многопоточный таракан?
М-м-м… оригинально…

Очень хочется, чтобы игры с размером стека не прошли. Задолбали вы своим мусором, ребята. Так что вините себя же… творцы спамерских тулзов… блин.


 
Digitman ©
 
(2004-04-29 08:32)
[29]

хуже спамера только спамер-дилетант с инициативой)
безо всяких доп.потоков вполне можно обойтись для решения той же гнилой задачи)


 
Smithson ©
 
(2004-04-29 10:46)
[30]

Тимохов ©   (28.04.04 19:00) [22]
Для общего развития можно уточнения? Из главного (первого) потока прорцесса или из вызывающего потока? Ведь BeginThread может дернуть и вторичный поток…


 
Тимохов ©
 
(2004-04-29 11:25)
[31]


> Smithson ©   (29.04.04 10:46) [30]

В доке написано, что если передавать 0, то будет браться размер стека главного потока.

Сами посмотрите createthread+f1.

Всем.
Вот блин — в анкету забыл посмотреть и совет дал, хорошо бы чтобы не правильный :(((


 
Smithson ©
 
(2004-04-29 11:28)
[32]

Спасибо, пошел в MSDN. Не люблю я его…


 
Тимохов ©
 
(2004-04-29 11:30)
[33]


> Smithson ©   (29.04.04 11:28) [32]

Можно в дельфи почитать
вот

dwStackSize

Specifies the size, in bytes, of the stack for the new thread. If 0 is specified, the stack size defaults to the same size as that of the primary thread of the process.


 
csr ©
 
(2004-04-29 12:26)
[34]

Спасибо за понимание господа)) А неподскажите-ли также любезно, от чего может происходить ошибка Thread creation error: Not enough storage is available to process this command?


 
Игорь Шевченко ©
 
(2004-04-29 12:35)
[35]

csr ©   (29.04.04 12:26)

Не подскажем.

Spamers must die.


 
Григорьев Антон
 
(2004-04-29 12:39)
[36]


> csr ©   (29.04.04 12:26) [34]
> Спасибо за понимание господа))

Какое, к чёрту, понимание? Нормальный человек никогда не поймёт тех [вырезано цензурой], которые зарабатывают деньги тем, что портят жизнь другим людям.


 
Юрий Зотов ©
 
(2004-04-29 12:55)
[37]

> csr ©   (29.04.04 12:26) [34]

> от чего может происходить ошибка Thread creation error: Not
> enough storage is available to process this command?

Я думаю, Вам стоит написать письмо с этим вопросом в известный Центр американского английского. Нет сомнений, что тамошние специалисты смогут совершенно точно перевести эту фразу и дать квалифицированный ответ. Причем неоднократно. Чтобы лучше дошло.


 
Digitman ©
 
(2004-04-29 13:06)
[38]


> csr ©   (29.04.04 12:26) [34]
> от чего может происходить ошибка Thread creation error:
> Not enough storage is available to process this command?

в при всем неприятии тебя как LMD и SMD тебе теме не менее уже разжевали — ты как минимум стеками своих потоков «сожрал» ВСЕ доступное ВАП процесса)).. не говоря уже о прикладной «спаммерской» логики самих потоков))

p.s.
«Боня, ты тупой !» (с) КВН


 
Тимохов ©
 
(2004-04-29 13:25)
[39]


> «Боня, ты тупой !» (с) КВН

а куда же им деваться, только в спамеры подаваться.

«От Ивана.
Супир нодддежжные маас совые росссылке 10000000000 адрисссов всиго за 100 уё»


 
csr ©
 
(2004-04-30 14:35)
[40]

Удалено модератором
Примечание: Offtopic


Overview of the application:
I have a Delphi application that allows a user to define a number of queries, and run them concurrently over multiple MySQL databases. There is a limit on the number of threads that can be run at once (which the user can set). The user selects the queries to run, and the systems to run the queries on. Each thread runs the specified query on the specified system using a TADOQuery component.

Description of the problem:
When the queries retrieve a low number of records, the application works fine, even when lots of threads (up to about 100) are submitted. The application can also handle larger numbers of records(150,000+) as long as only a few threads (up to about 8) are running at once. However, when the user is running more than around 10 queries at once (i.e. 10+ threads), and each thread is retrieving around 150,000+ records, we start getting errors. Here are the specific error messages that we have encountered so far:

a: Not enough storage is available to complete this operation
b: OLE error 80040E05
c: Unspecified error
d: Thread creation error: Not enough storage is available to process this command
e: Object was open
f: ODBC Driver does not support the requested properties

Evidently, the errors are due to a combination of factors: number of threads, amount of data retrieved per thread, and possibly the MySQL server configuration.

The main question really is why are the errors occurring? I appreciate that it appears to be in some way related to resources, but given the different errors that are being returned, I’d like to get my head around exactly why the errors are cropping up. Is it down to resources on the PC, or something to do with the configuration of the server, for example.

The follow up question is what can we do to avoid getting the problems? We’re currently throttling down the application by lowering the number of threads that can be run concurrently. We can’t force the user to retrieve less records as the queries are totally user defined and if they want to retrieve 200,000 records, then that’s up to them, so there’s not much that we can do about that side of things. Realistically, we don’t want to throttle down the speed of the application because most users will be retrieving small amounts of data, and we don’t want to make the application to slow for them to use, and although the number of threads can be changed by the user, we’d rather get to the root of the problem and try to fix it without having to rely on tweaking the configuration all the time.

AFAIK, both for Windows and Linux the limitation for the number of threads is determined by the size of the memory available.

And, yes, as written by marcov, for a 32 bits program 2GB is the upper limitation (which ever is the real size of the memory), when using a ‘unmodified’ 32 bits Windows OS.

2 links on the net found after a very brief research:
 *  Windows: http://blogs.msdn.com/b/oldnewthing/archive/2005/07/29/444912.aspx
 *  Linux: http://stackoverflow.com/questions/344203/maximum-number-of-threads-per-process-in-linux

Anyway, I’m a bit surprised with your maximum number of threads when you modify the stack size during compilation.

I’ve made some tests with the small test program proposed in my first link. I’ve just modified it by using the FPC APIs instead of calling directly the Windows API.

Free Pascal test program:

program project1;

// Caution: this program doesn't release its resources (i.e. resources are
//     supposed to be released by the OS when the program terminates).

{$mode objfpc}{$H+}

uses
  SysUtils;

function ThreadFunc(PP: Pointer): Integer;
const
  INFINITE = DWORD($FFFFFFFF);
begin
  Sleep(INFINITE);
  result := 0;
end;

procedure Test();
var NbrThreadCreated: Integer;
var Id: Longword;
var H: THandle;
var i1: Integer;
begin
  NbrThreadCreated := 0;
  for i1 := 0 to Pred(500000) do
    begin
      H := BeginThread(Nil, 0, @ThreadFunc, Nil, 0, Id);
      if H=0 then Break;
      Inc(NbrThreadCreated);
    end;
  WriteLn('Number of threads created: '+IntToStr(NbrThreadCreated));
end;

begin
  Test();
end.


And here are my results (on Windows 32 bits => 2 GB limitation, and 512 MB of real memory):

. no Cs value (i.e. by default FPC value — 16MB I guess):   122
. Cs = 1048576 (i.e. 1 MB):   2011
. Cs = 524288 (i.e. 512 KB):   3996

Which seems quite coherent with my own 2GB limits.

So, theoretically you should have much more than 244 possible threads; especially with 64 bits programs and OS.

Of course, it’s possible that your threads need a lot of memory to run properly (mines are just doing nothing in this test program).

wow thanks for the info. :D

but even though you have all that huge free space. and fast system.

this is the error that seems to be showing up every now and then with different updates.
or newbies to the program.

and i’ve had it show up since 2004 or so.
as snipertaz has said cutting the size being scanned is the only thing that seems to fix it when it does show its ugly bug head in the program.

this tells me monkey has an on going code bug that is ramping up the cpu cycles and fills the ram to the point it crashes,
and the wording on the alert is not from monkey but from windows, which can only mean it can’t get to the memory needed because it is full. you are sitting there saying how the ….ll can it be full with that much ram. simple by monkey loading all the info in to ram for each song and holding it there until he writes it in to the database. which now brings us to the reason windows locks and crashes, the database grows with each song added, and if all the ram is full from the songs and the swap file is full and the cpu is at 100% used by mediamonkey, there is nothing left for windows to adjust the size of the database file. so it can’t access the file and allow monkey to write the new data for the next song in line,

that is the only thing that makes sense as this error is a constently happening error.
i have found some things that help me and i try to tell them to people but i don’t think some here like that as i get a few posts now and then telling me to stop it. but it works for me on most the errors so i say them.

you can find it in lots of my other posts but here goes again.

1 get a program to work with your os that allows you to set the priority to apps and keep it set after a reboot.
set the mediamonkey.exe priority to high priority.
don’t mess with windows system process’es they don’t like it when they are changed and do mess up if they are.
(edited in cause i forgot to say it :oops: )
you are wondering what the speeding up does? simple it makes monkey write faster to the database which allows
for more data to be removed from ram and less cpu cycles in use. so windows has a slight chance at getting the database
file adjusted before it crashes. :)

2 get a program called maxmem from analogx.com it is to keep the ram cleaned of junk. like when you move out you leave your broken chairs and torn curtains in the apartment, same thing with apps when you close them, so you need to
get this small very small foot printed program to clean it out. or one that works with your os.

3 get cleanmem from majorgeeks.com it takes all the apps that start up with boot up and never get used but hog huge
amounts of ram for them to use if ever they are used, and strips the ram from them allowing only the kb’s they need to stay launched and puts the ram back in the ram pool. the apps will get it again if they do start.

4 keep your system cleaned and you already do that so you know the apps to use. but make sure you also go to all the apps you use that log things and remove the log files from the days of your mayflower trip to now. just keep one or two back up logs. also clean out any too old system restore files i found the other day that you can do that with ccleaner.

5 as snipertaz has also suggested use smaller groups when scanning the whole library, but i’ll go one more step for those with dual cores or quad cores, use monkeys options for setting up what is done on what core so other use of the computer wont cause crashes from over loaded cpu cores.

that is all i can think of you can do to counteract this error. 8)

roving cowboy / keith hall. My skins http://www.mediamonkey.com/forum/viewto … =9&t=16724 for some help check on Monkey’s helpful messages at http://www.mediamonkey.com/forum/viewto … 4008#44008 MY SYSTEMS.1.Jukebox WinXp pro sp 3 version 3.5 gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 2.WinXP pro sp3, vers 2.5.5 and vers 3.5 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.Dell demension, winxp pro sp3, mm3.5 spare jukebox.) 4.WinXp pro sp3, vers 3.5, dad’s computer bought from computer store. )5. Samsung Galaxy A51 5G Android ) 6. amd a8-5600 apu 3.60ghz mm version 4 windows 7 pro bought from computer store.

User1122355199 posted

Hello everyone and thanks for your help in advance.  I have a MVC page that updates a database table that is intermittently throwing the following error:

System.Data.SqlClient.SqlException (0x80131904): Failed to create AppDomain "master.sys[runtime].3". Could not load file or assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Not enough storage is available to process this command.

I have never experienced this error message before and really haven’t found a good solution on Google.  Here is my query:

CREATE PROCEDURE [dbo].[sp_Update_tbl_Log_Correspondence]
	-- Add the parameters for the stored procedure here
	 @ID	 					[int],
	 @ReviewedDate 				[datetime],
	 @ReviewedBy 				[varchar](50),
	 @TestsPerformed 			[varchar](1000),
	 @ActionStatus	 			[varchar](50),
	 @ActionTaken 				[varchar](5000),
	 @ERVisit		 			[varchar](50),
	 @SendTextFollowup		 	[varchar](50),
	 @ReferralID				[int]
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	/*New*/
	DECLARE @MRNumber					[varchar](50)
	DECLARE @PreviousActionTaken		[varchar](5000)
	DECLARE @CurrentActionTaken			[varchar](5000)
	DECLARE	@SignatureStamp				[varchar](500)
	DECLARE @PreveiousTestsFerformed	[varchar](500)
	DECLARE @CurrentTestsFerformed		[varchar](500)

	IF(@ActionTaken IS NULL)
		BEGIN
			SET @ActionTaken = ''
		END

	SET @ReviewedDate = GetDate()
	SET @SignatureStamp = '<span class="datestamp">' + FORMAT(@ReviewedDate, 'MM/dd/yyyy hh:mm:ss tt') + '</span> - <span class="signature">' + @ReviewedBy + '</span>'
	Select @PreviousActionTaken = ISNULL(ActionTaken, ''), @PreveiousTestsFerformed = ISNULL(TestsPerformed, ''), @MRNumber = MRNumber From tbl_Log_Correspondence Where ID = @ID
	If (@PreviousActionTaken = '')
		BEGIN
			SET @CurrentActionTaken = @SignatureStamp + ' - ' + @ActionTaken
		END
	ELSE
		BEGIN
			SET @CurrentActionTaken = @PreviousActionTaken + '<br/><br/>' + @SignatureStamp + ' - ' + @ActionTaken
		END
	
	SET @CurrentTestsFerformed = @PreveiousTestsFerformed + ' ' + @TestsPerformed

    -- Insert statements for procedure here
	UPDATE [myDB].[dbo].[tbl_Log_Correspondence] 

	SET  [ReviewedDate]	 = @ReviewedDate,
		 [ReviewedBy]	 = @ReviewedBy,
		 [TestsPerformed]	 = @CurrentTestsFerformed,
		 [ActionStatus]	 = @ActionStatus,
		 [ActionTaken]	 = @CurrentActionTaken,
		 [ERVisit]		= @ERVisit,
		 [SendTextFollowup] = @SendTextFollowup,
		 [ReferralID] = @ReferralID

	WHERE 
		( [ID]	 = @ID)

	If (@SendTextFollowup = 'Yes - Send ER Followup')
		BEGIN
			EXEC sp_InsertMessageToQueue @MRNumber, 'ER Followup'
		END

	If (@SendTextFollowup = 'Yes - Send Referral Followup')
		BEGIN		
			EXEC sp_InsertMessageToQueue @MRNumber, 'Specialist Report Followup'
		END
		/*
	ELSE
		BEGIN
			SET @CurrentActionTaken = @PreviousActionTaken + '<br/><br/>' + @SignatureStamp + ' - ' + @ActionTaken
		END
		*/

END

Now I arguably have too much business logic within the query, but I really didn’t think that would cause this problem and there is only one large column declared a varchar(5000) which I didn’t think would be such a problem.  As I mentioned, the problem
is intermittent, so I’m really not sure where to start debugging.  Any help would be appreciated.

Понравилась статья? Поделить с друзьями:
  • Thread creation error delphi
  • This service is not available in your region crossfire как исправить
  • Thread 1 signal sigabrt swift как исправить
  • Thread 1 fatal error init coder has not been implemented
  • This servers accepts only legit clients go and buy it right now at как исправить