CopyRates - BUG

 

CopyRates freezes when switching timeframe, in this case from H1 to M15 for 60 seconds.

As far as I see, it happens mainly when an indicator in the same chart with the EA accesses the same bars data.

Its surely not a coincidence, that the DST changed today in Europe, while the servers DST did not change yet. 

This is also not new, every year the same procedure and it will take some days until its gonna be fine again. 

Params are: 

symbolname="BTCUSD"

tf=PERIOD_CURRENT

shift = 345

cnt = 1


Its really hard to stay polite when seeing the same SERIOUS bugs for years over and over again. This code, which even tries to detect this problem is from 2017!!!! That is almost a decade!


 
PS: Latest build MT5
 

Bug report without code and details needed to reproduce it are just ignored.

Picture of code is not code.

 
Alain Verleyen #:

Bug report without code and details needed to reproduce it are just ignored.

Picture of code is not code.

? This is the code. Thats it. CopyRates needs a minute to return without a result. 

Yes and complex sample code will be answered by MQ with: "Oh, your code is very much nested". Thats my experience also. And then, nothing happened anymore. 

You cant reproduce it with a specific code anyway, since its an issue that is not happening all the time and CopyRates should never need a minute, simply never. Since its exactly a minute, it very likely looks like a thread collission and a mutex-timeout under specific circumstances. 

 

The reality is:

Bugs, which occur in complex environments, will never be fixed.

 
Doerk Hilger #:

The reality is:

Bugs, which occur in complex environments, will never be fixed.

The reality is you don't provide anything to even prove there is a bug, not even logs.

Your prefer to complain.

 
Alain Verleyen #:

The reality is you don't provide anything to even prove there is a bug, not even logs.

Your prefer to complain.

Alain, I had this chat even with Renat personally, also with some coders of MQ. 

And I sent confidential code with more than 20.000 lines to MQ directly. And like I said, the answer was "Pretty nested" or sth like that. 

You don't know everything I tried and did, nothing about all my efforts in view of this.

I am seeking for support, not personal judgement. 

 
Doerk Hilger #:

Alain, I had this chat even with Renat personally, also with some coders of MQ. 

And I sent confidential code with more than 20.000 lines to MQ directly. And like I said, the answer was "Pretty nested" or sth like that. 

You don't know everything I tried and did, nothing about all my efforts in view of this.

I am seeking for support, not personal judgement. 

I can only talk about what I see and read. 

I am always ready to help but I can't do anything about your CopyRates issue with what you provided.

 

Explanation:

EA and indicator accessed both the same symbol and the same bar-data using CopyRates for just the first bar in the chart. EA had to do this when changing the timeframe, but the indicators gets initialized same time. And since the data was obviously updated after DST change in my country, CopyRates needed longer time than usual and collided with the indicator. 


Workaround:

Alternative 1: The indicator waits til the EA is back to Idle state and then accesses the bar-data again. I can do this using my IPC libs. 

Alternative 2: Indicator and EA, both use the same mutex, at least when accessing the first bar.  


Bug:

The bug is clearly caused by a race condition between EA and indicator, the mutex is the proof. This should never be the case and MQL code should be treated thread-safe.  

Source-code proof:

I remember similar problems, also with non-accessible bar data. Source code alone is not enough. To reproduce this, all bar data needs to be deleted first and then the brokers-server has to be slow enough that this race condition has a chance. Source code is needed for EA and indicator, both have to access the same bar-data exactly the same time. 

Since I created this further workaround now using DLL code, the problem is gone for me. But not for anyone else who will see unexplainable freezes, not knowing how this is related and how this can be fixed. 

If someone wants to try, I offer my support. I will provide code only when MQ is involved directly, since there is no guarantee at all its reproducible. There might be other factors kicking in to provoke the race-condition, which I don´t know. 

 
@Doerk Hilger #... If someone wants to try, I offer my support. I will provide code only when MQ is involved directly, since there is no guarantee at all its reproducible. There might be other factors kicking in to provoke the race-condition, which I don´t know. 
Hello Doerk,

you can send all details to me, I'll investigate.
 
I suppose that is one of the reasons.