camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vss123 <>
Subject File 'markerFile' strategy race condition
Date Fri, 31 May 2013 13:12:53 GMT
Hi,We use camel 2.11 version on Linux.We run two instances of camel which
watch on the a directory to pick, process  and move files to processed
directory on successful completion. On error it gets moved to error
directory. We use 'markerFile' as a strategy for read lock.What we observe
is that sometimes a file gets picked by both the instances, resulting in
  File named /A.txt/ gets picked by /Camel 1/ instance and lock file
/A.txt.camelLock/ gets created.
 / Camel 1/ instance reads and finishes processing the file /A.txt/ 
 / Camel 1/ instance deletes /A.txt.camelLock/ 
 / Camel 2/ instance picks /A.txt/ as there is not lock to it now and starts
processing. It creates /A.txt.camelLock/ 
 / Camel 1/ instance moves /A.txt/ to processed dir. 
 / Camel 2/ instance deletes /A.txt.camelLock/ as it finished processing  
 / Camel 2/ faces error as it tries to move /A.txt/ to processed dir as 
/A.txt/ is not available anymore 
 / Camel 2/ faces further error as it tries to move /A.txt/ to error dir
because of previous error and obviously it cannot find  /A.txt/
The problem is /.camelLock/ file gets deleted before the actual files gets
moved to processed dir. And if we flip the order, this race condition should
not happen.Can you help us to understand the reasoning behind this design
and how to avoid this error?

View this message in context:
Sent from the Camel - Users mailing list archive at
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message