This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrfjprog bug: gets stuck due to temporary directory permissions

Hi,

while flashing devices in production testing our customer ran into the following problem.

modemFW_flash.py got stuck in an infinite loop, making no progess but consuming 100% CPU.

Running it with strace revealed the tool was repeatedly doing this:

stat("/tmp/nrfjprogdll/highlevel/fileXrbQJF", 0x7ffc0cd5fed0) = -1 ENOENT (No such file or directory)

This failure to access temporary files turned out to be due to the directory tree /tmp/nrfjprogdll being owned by a different user, and the directories in that tree did not have write permission for "other".  Perhaps the tool had tried to create the file, which failed due to not having "write" access, and the tool had ignored the error, then thinks it will magically appear if it just calls stat() often enough.

There are several things wrong here:

1) Temporary directory has fixed path, making it impossible for different users to run the tool.

2) Temporary directory from previous use was not cleaned up.

3) Fixed path directory tree which needs to be shared between users is not created with permissions which would allow sharing.

4) Failure to access files is not handled gracefully. The tool should exit with error code if it cannot access files and directories it needs. When retrying due to error codes returned, there should be a time delay to avoid using 100% CPU and also a limit for retries, after which the tool would give up.

Parents Reply Children
Related