Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

DataCacheException: Wrong data from file
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=16&t=50467
Page 1 of 1

Author:  GeniuZ [ Thu 05 Dec, 2013, 15:40 ]
Post subject:  DataCacheException: Wrong data from file

About last two weeks when process IHistory.getTicks, exception appears in live JForex platform on all pairs, several times per day.

com.dukascopy.api.JFException: Error while loading ticks
   at com.dukascopy.api.impl.m.a(Unknown Source)
   at com.dukascopy.api.impl.bg.run(Unknown Source)
   at com.dukascopy.api.impl.bg.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at com.dukascopy.api.impl.m.getTicks(Unknown Source)
   at jforex.Strategy.onTick(Strategy.java:1676)
   at com.dukascopy.api.impl.execution.w.ca(Unknown Source)
   at com.dukascopy.api.impl.execution.a.call(Unknown Source)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at com.dukascopy.api.impl.execution.g$a.f(Unknown Source)
   at com.dukascopy.api.impl.execution.g$a.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: com.dukascopy.charts.data.datacache.DataCacheException: Wrong data from file [C:\Users\FX\Local Settings\JForex\.cache\EURCAD\intraperiod\2013_12_05_11_ticks.bi5], read tick with time [2013-12-05 11:00:00:486], previous tick time [2013-12-05 11:45:00:540]
   at com.dukascopy.charts.data.datacache.CacheManager.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.ck.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.ck.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.bw.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.bv.run(Unknown Source)
   at com.dukascopy.charts.data.datacache.ai.b(Unknown Source)

Author:  API Support [ Mon 27 Jan, 2014, 09:59 ]
Post subject:  Re: DataCacheException: Wrong data from file

Please provide an example strategy which replicates the case. Please provide the instrument list that the platform has subscribed to. Please provide specific strategy launch conditions, if any.

Author:  GeniuZ [ Mon 27 Jan, 2014, 10:55 ]
Post subject:  Re: DataCacheException: Wrong data from file

I have launched about ten strategies on lots of pairs on live account.
For example one strategy on EUR/USD only, second strategy on 28 pairs etc.
Next similar strategies I have launched on demo account under JForex-SDK on same computer.
Problem maybe can be when two platforms access one data store.
Exception can appears for example only one times per day.
Different exceptions details appears:

NHK-EU: EUR/USD: can't obtain ticks from 03.01'14 15:21:17 to 03.01'14 15:21:18
com.dukascopy.api.JFException: Error while loading ticks
   at com.dukascopy.api.impl.m.a(Unknown Source)
   at com.dukascopy.api.impl.bg.run(Unknown Source)
   at com.dukascopy.api.impl.bg.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at com.dukascopy.api.impl.m.getTicks(Unknown Source)
   at jforex.Strategy.onTick(Strategy.java:1705)
   at com.dukascopy.api.impl.execution.w.cd(Unknown Source)
   at com.dukascopy.api.impl.execution.a.call(Unknown Source)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at com.dukascopy.api.impl.execution.g$a.f(Unknown Source)
   at com.dukascopy.api.impl.execution.g$a.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: com.dukascopy.charts.data.datacache.DataCacheException: java.io.IOException: Stream Closed
   at com.dukascopy.charts.data.datacache.cl.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.cl.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.bx.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.bw.run(Unknown Source)
   at com.dukascopy.charts.data.datacache.aj.b(Unknown Source)
   ... 12 more
Caused by: java.io.IOException: Stream Closed
   at java.io.RandomAccessFile.seek(Native Method)
   at com.dukascopy.charts.data.datacache.CacheManager.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CacheManager.a(Unknown Source)
   ... 19 more
NHK-UJ: USD/JPY: can't obtain ticks from 06.01'14 17:17:21 to 06.01'14 17:17:21
com.dukascopy.api.JFException: Error while loading ticks
   at com.dukascopy.api.impl.m.a(Unknown Source)
   at com.dukascopy.api.impl.bg.run(Unknown Source)
   at com.dukascopy.api.impl.bg.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at com.dukascopy.api.impl.m.getTicks(Unknown Source)
   at jforex.Strategy.onTick(Strategy.java:1705)
   at com.dukascopy.api.impl.execution.w.cd(Unknown Source)
   at com.dukascopy.api.impl.execution.a.call(Unknown Source)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at com.dukascopy.api.impl.execution.g$a.f(Unknown Source)
   at com.dukascopy.api.impl.execution.g$a.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: com.dukascopy.charts.data.datacache.DataCacheException: Wrong data from file [C:\Users\XX\Local Settings\JForex\.cache\USDJPY\intraperiod\2014_01_06_17_ticks.bi5], read tick with time [2014-01-06 17:17:18:156], previous tick time [2014-01-06 17:17:21:427]
   at com.dukascopy.charts.data.datacache.CacheManager.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.cl.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.cl.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.bx.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.bw.run(Unknown Source)
   at com.dukascopy.charts.data.datacache.aj.b(Unknown Source)
   ... 12 more
NHK-EU: EUR/USD: can't obtain ticks from 07.01'14 9:54:59 to 07.01'14 9:55:00
com.dukascopy.api.JFException: Error while loading ticks
   at com.dukascopy.api.impl.m.a(Unknown Source)
   at com.dukascopy.api.impl.bg.run(Unknown Source)
   at com.dukascopy.api.impl.bg.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at com.dukascopy.api.impl.m.getTicks(Unknown Source)
   at jforex.Strategy.onTick(Strategy.java:1705)
   at com.dukascopy.api.impl.execution.w.cd(Unknown Source)
   at com.dukascopy.api.impl.execution.a.call(Unknown Source)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at com.dukascopy.api.impl.execution.g$a.f(Unknown Source)
   at com.dukascopy.api.impl.execution.g$a.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: com.dukascopy.charts.data.datacache.DataCacheException: java.io.IOException: The handle is invalid
   at com.dukascopy.charts.data.datacache.cl.c(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.bw.run(Unknown Source)
   at com.dukascopy.charts.data.datacache.aj.b(Unknown Source)
   ... 12 more
Caused by: java.io.IOException: The handle is invalid
   at java.io.RandomAccessFile.readBytes0(Native Method)
   at java.io.RandomAccessFile.readBytes(Unknown Source)
   at java.io.RandomAccessFile.read(Unknown Source)
   at com.dukascopy.charts.data.datacache.cl.a(Unknown Source)
   ... 18 more
NHK-UJ: USD/JPY: can't obtain ticks from 09.01'14 1:22:09 to 09.01'14 1:22:10
com.dukascopy.api.JFException: Error while loading ticks
   at com.dukascopy.api.impl.m.a(Unknown Source)
   at com.dukascopy.api.impl.bg.run(Unknown Source)
   at com.dukascopy.api.impl.bg.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at com.dukascopy.api.impl.m.getTicks(Unknown Source)
   at jforex.Strategy.onTick(Strategy.java:1705)
   at com.dukascopy.api.impl.execution.w.cd(Unknown Source)
   at com.dukascopy.api.impl.execution.a.call(Unknown Source)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at com.dukascopy.api.impl.execution.g$a.f(Unknown Source)
   at com.dukascopy.api.impl.execution.g$a.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: com.dukascopy.charts.data.datacache.DataCacheException: Data cache file corrupted
   at com.dukascopy.charts.data.datacache.CacheManager.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CacheManager.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.cl.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.cl.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.bx.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.bw.run(Unknown Source)
   at com.dukascopy.charts.data.datacache.aj.b(Unknown Source)
   ... 12 more
NHK-AJ: AUD/JPY: can't obtain ticks from 14.01'14 17:08:08 to 14.01'14 17:08:08
com.dukascopy.api.JFException: Error while loading ticks
   at com.dukascopy.api.impl.m.a(Unknown Source)
   at com.dukascopy.api.impl.bg.run(Unknown Source)
   at com.dukascopy.api.impl.bg.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at com.dukascopy.api.impl.m.getTicks(Unknown Source)
   at jforex.Strategy.onTick(Strategy.java:1705)
   at com.dukascopy.api.impl.execution.w.cd(Unknown Source)
   at com.dukascopy.api.impl.execution.a.call(Unknown Source)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at com.dukascopy.api.impl.execution.g$a.f(Unknown Source)
   at com.dukascopy.api.impl.execution.g$a.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: com.dukascopy.charts.data.datacache.DataCacheException: Wrong data from file [C:\Users\XX\Local Settings\JForex\.cache\AUDJPY\intraperiod\2014_01_14_17_ticks.bi5], read tick with time [2014-01-14 17:01:33:231], previous tick time [2014-01-14 17:08:08:642]
   at com.dukascopy.charts.data.datacache.CacheManager.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.cl.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.cl.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.bx.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.bw.run(Unknown Source)
   at com.dukascopy.charts.data.datacache.aj.b(Unknown Source)
   ... 12 more
NHK-UJ: USD/JPY: can't obtain ticks from 21.01'14 0:15:07 to 21.01'14 0:15:08
com.dukascopy.api.JFException: Error while loading ticks
   at com.dukascopy.api.impl.m.a(Unknown Source)
   at com.dukascopy.api.impl.bg.run(Unknown Source)
   at com.dukascopy.api.impl.bg.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at com.dukascopy.api.impl.m.getTicks(Unknown Source)
   at jforex.Strategy.onTick(Strategy.java:1705)
   at com.dukascopy.api.impl.execution.w.cd(Unknown Source)
   at com.dukascopy.api.impl.execution.a.call(Unknown Source)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at com.dukascopy.api.impl.execution.g$a.f(Unknown Source)
   at com.dukascopy.api.impl.execution.g$a.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: com.dukascopy.charts.data.datacache.DataCacheException: java.io.IOException: Stream Closed
   at com.dukascopy.charts.data.datacache.cl.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.cl.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.bx.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.bw.run(Unknown Source)
   at com.dukascopy.charts.data.datacache.aj.b(Unknown Source)
   ... 12 more
Caused by: java.io.IOException: Stream Closed
   at java.io.RandomAccessFile.readBytes0(Native Method)
   at java.io.RandomAccessFile.readBytes(Unknown Source)
   at java.io.RandomAccessFile.read(Unknown Source)
   at com.dukascopy.charts.data.datacache.CacheManager.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CacheManager.a(Unknown Source)
   ... 19 more
NHK-UJ: USD/JPY: can't obtain ticks from 22.01'14 15:36:02 to 22.01'14 15:36:03
com.dukascopy.api.JFException: Error while loading ticks
   at com.dukascopy.api.impl.m.a(Unknown Source)
   at com.dukascopy.api.impl.bg.run(Unknown Source)
   at com.dukascopy.api.impl.bg.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at com.dukascopy.api.impl.m.getTicks(Unknown Source)
   at jforex.Strategy.onTick(Strategy.java:1705)
   at com.dukascopy.api.impl.execution.w.cd(Unknown Source)
   at com.dukascopy.api.impl.execution.a.call(Unknown Source)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at com.dukascopy.api.impl.execution.g$a.f(Unknown Source)
   at com.dukascopy.api.impl.execution.g$a.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: com.dukascopy.charts.data.datacache.DataCacheException: Data cache corrupted, cannot delete file [C:\Users\XX\Local Settings\JForex\.cache\USDJPY\intraperiod\2014_01_22_15_ticks.bi5]
   at com.dukascopy.charts.data.datacache.cl.c(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.CurvesDataLoader.a(Unknown Source)
   at com.dukascopy.charts.data.datacache.bw.run(Unknown Source)
   at com.dukascopy.charts.data.datacache.aj.b(Unknown Source)
   ... 12 more


Attachments:
TickException.java [1.38 KiB]
Downloaded 96 times

Author:  liamroche [ Fri 19 Dec, 2014, 14:37 ]
Post subject:  Re: DataCacheException: Wrong data from file

I had a similar problem to this, and was equally puzzled at first, but I have found out what was causing it and how to work around the problem.

The problem occurs because two jforex clients share the same data directory by default. The two clients access the same files and some sort of inconsistency occurs.
For example, I am running a strategy from Netbeans and the jforex client at the same time. Errors like this occur. But with no jforex client there are no errors.

Obviously, it is useful to be able to run an IDE as well as the jforex client for several purposes. Fortunately, there is an easy workaround.
In the jforex client, go to menu Tools - Preferences and choose the Advanced tab. The first entry is the "local cache path". This gives the directory where real time data is stored.
Change the directory to something other than the path given (I changed .cache to .cache2 at the end of the path).

After this is done and the jforex client is restarted, the IDE and jforex client will manage separate copies of the live data and no clash will occur, and the error described here will be avoided.

Author:  liamroche [ Fri 19 Dec, 2014, 17:30 ]
Post subject:  Re: DataCacheException: Wrong data from file

Anyhow, as this is an undesired behaviour that has to be worked around (and that it is easy for someone not to be able to see how to do this)
it does qualify as a bug that could be fixed in some way.

Author:  API Support [ Mon 05 Jan, 2015, 10:36 ]
Post subject:  Re: DataCacheException: Wrong data from file

This bug is fixed on DEMO. Next SDK release will also contain the fix.

  Page 1 of 1