OnInit() execution fail

 

A very serious bug is, that MT5 (MT4 maybe - not debugged) stops execution of EA without any any error message, the EA is just gone from the chart - OR - MT5 freezes and with this freeze, the whole Windows instance freezes as well. In case of last, the only way to get out is using the task manager of another account with administrator rights and terminate the execution of the MetaTrader terminal manually. This happens mainly, when I switch from a higher timeframe to a very much lower, e. g. from D1 to M1, from small to high it never happened. 

I tried to debug this, and found out at least, that OnInit() is no longer executed in such cases. I was able to debug until OnDeinit(), but OnInit() was no longer reached.

To ensure that it´s not a problem of my code at all, I implemented a function which allows me to stop any actions and to exit immediately from OnTimer(), OnTick(), OnChartEvent() etc., so that no code is executed anymore. But the behavior is still the same: Crash or drop. 

Furthermore, I implemented a function which postpones the execution of OnInit(). This means, OnInit() is just recognized by my code, but any further actions are triggered within next OnTimer(). Also same result: Crash or drop. 

This is why I come to the conclusion, that the EA engine of MT crashes itself so that OnInit() is not executed. 

I also tried to create a sample code which is creating >1000 chart objects and using >50 MB of memory, delaying within OnTimer(), OnTick() to stress MT etc. but without success, it does not happen with a simple sample code, so I suspect that this happens only with very complex code. And as usual - it does not happen always, but mostly, and once again we talk about one of these SomeTimes-Bugs. If MetaQuotes want to see this behavior, I can provide a download link to the executable .ex5 or .ex4 file. 

 
Doerk Hilger :


100% - an error in your code. I even give 1000%.

 
Vladimir Karputov:

100% - an error in your code. I even give 1000%.

You seem to overlooked the fact, that my code is stopped entirely and the behavior is the same. 

>>To ensure that it´s not a problem of my code at all, I implemented a function which allows me to stop any actions and to exit immediately from OnTimer(), OnTick(), OnChartEvent() etc., so that no code is executed anymore. But the behavior is still the same: Crash or drop. <<

All such functions just perform an immediate return and do absolutely nothing else. 

And besides this, how can it be, the the EA is dropped without any error code or any recognition in the experts journal at the toolbox.
 

On top of this,

- no MQL code is executed between OnDeinit() and the next OnInit(), how could any source code help here?

- an infinite loop can freeze MT, yes, but you still have access to the Task Manager and/or get a message that MT is no longer responding. Not so here, I cannot access anything in this Windows instance.

So this and the arguments before is the reason why I claim, that it must be any kind of a bug in MT.

 
William Roeder
  1. We can do nothing with .EXn

Of course, it´s p-code, ex4/ex5 is good enough to trace wrong behavior in the execution of such. And by the way, I don´t rush, never, I tried all I can to isolate this and before I claim a bug, it takes a very long time. 

 
Doerk Hilger :

Of course, it´s p-code, ex4/ex5 is good enough to trace wrong behavior in the execution of such. And by the way, I don´t rush, never, I tried all I can to isolate this and before I claim a bug, it takes a very long time. 

Search and correct your mistakes. And by the way, We do not know how to read your thoughts and We cannot see your MQL5 code at a distance.

 
Vladimir Karputov:

Search and correct your mistakes. And by the way, We do not know how to read your thoughts and We cannot see your MQL5 code at a distance.

Which part of the description, that there is NO CODE but immediate returns was unclear? You don´t neet to read my mind, please just read what I describe. It simply could have been, that there is someone else around who has the same issue. Your answers really do not help at all, they just blow up this thread.

 
Doerk Hilger :

Which part of the description, that there is NO CODE but immediate returns was unclear? You don´t neet to read my mind, please just read what I describe. It simply could have been, that there is someone else around who has the same issue. Your answers really do not help at all, they just blow up this thread.

This is a technical forum. If you have not provided a code, if you have not described anything, no one will do anything. Please, if there is no code, do not write anything.

 
Doerk Hilger:

Which part of the description, that there is NO CODE but immediate returns was unclear? You don´t neet to read my mind, please just read what I describe. It simply could have been, that there is someone else around who has the same issue. Your answers really do not help at all, they just blow up this thread.

Vladimir is perfectly right. Nobody can help you, and Metaquotes will do nothing. I already explained you that point several times.

No code, no help. Not reproducible, no fix.

 
Alain Verleyen:

Vladimir is perfectly right. Nobody can help you, and Metaquotes will do nothing. I already explained you that point several times.

No code, no help. Not reproducible, no fix.

I wasn´t asking for direct help, because I know that no-one except MetaQuotes could provide it. That´s why I wrote >>It simply could have been, that there is someone else around who has the same issue. <<. And if so, this one/these ones would know, that there is someone else with the same problem and a forum like this can be used to bring such people together to isolate such behavior together.

This is my intention, and I give you another, pretty good example:

In MT4 we had the issue, that indicators, which create own chart objects, were crashing MT4 (sometimes!), when such an indicator was removed via the popup-window of MT4 which lists all indicators which are loaded. The same indicator did never crash MT4, when it was removed by right-clicking the chart -> remove indicator or when it was terminated in the code itself. It took me 3 years to figure out that it just happens with indicators that create label-objects, 3 years to create a silly workaround to prevent such a crash. I never posted this in this forum, because I know your standard-answers. But a behavior like the described one, how can this be a problem of the code? The code just executes OnDeinit() when an indicator is removed, but same here: It was never reached just when the dialog window was used and just when label objects were created. How can this be an issue of the code instead of MT4? And by the way, with MT5 there were no problems at all, and the code is 1:1 the same. Code either works or works not, and if it works "sometimes-not", the focus should be on the environment, and this is MT itself.  I also found out, that in some cases the debugger delivers other results than the execution without and that the results seem to vary from machine to machine. By the way, this is why it absolutely never helps when someone writes "I don't have this problem, must be your code". 

And regarding the indicator issue, I am pretty sure that there are some others around the planet with the same issue and they have no solution, no workaround and especially no clue, that someone else already could provide such - just because of restrictions like "no code - no help. When a projects consist of hundreds of classes and thousands of lines of code, it´s not that simple to create a source-code sample to reproduce bugs, sometimes it takes days, even if you don´t know when the problem exactly occurs you will never be done with it. And you know Alain, that I always provide a source code when its easy to isolate a problem. And if it's not that easy, I allow myself to ask here if someone else maybe has the same problem.