Junk Character on file write when Process enabled on multiple node
Application Type
Traditional Web, Service
Service Studio Version
10.0.1022.0

Hi,

We write to a file in a process, these processes are spawned based on the number of requests received, so that each request is handled simultaneously and at end we are logging some information in a file. 

We are observing that If the environment is configured to execute process in only 1 server node there is no issue. But if its enabled on 2 or more server node, we are seeing junk characters inserted in file. Need to understand why junk characters are showing up, any help is appreciated, thanks.

Also is there a way to find out in which node process is created at run time?

mvp_badge
MVP

Hi Ashwathram,

When talking about a "node" I assume you mean a front-end server? And when talking about a "process", are you talking about Timers or about BPT Processes?

Regardless, if multiple processes write to a single file, you are going to get concurrency problems, so these junk characters don't come as a surprise.

Hi Killian,

yes. Node refers to server and process to BPT Processs.

When we run on single server, not observing any issues. So I was thinking before job run to check if Process enabled on more than 1 server than abort. 

We have the Environment configuration page which list server and what's enabled on that. From which entity can we read the same ?

mvp_badge
MVP

I don't think that would be the best solution. What I'd do is create a service that uses database locking (use a GetForUpdate entity action, even if it's only a control entitiy) to ensure single access to the file, and call that service from every process.

I assume the approach you mentioned is as below. Someone mentioned GetForUpdate() does not do a blocking wait, so I cannot use it to wait until file write is completed. Kindly do correct me if wrong and if below sequence will work. Thanks.

1. GetForUpdate on entity dummy

2. File write 

3. update record in step1 with current timestamp

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.