Opened 3 years ago

Closed 3 years ago

#19830 closed defect (fixed)

Check if recent directory exists before checking available space

Reported by: karsten Owned by: iwakeh
Priority: Medium Milestone: CollecTor 1.0.0
Component: Metrics/CollecTor Version:
Severity: Normal Keywords:
Cc: iwakeh Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Today this exception was thrown at me by a fresh CollecTor instance:

2016-08-04 12:28:16,067 WARN o.t.c.c.CollecTorMain:75 Cannot access out/recent; reason: out/recent
java.nio.file.NoSuchFileException: out/recent
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86) ~[na:1.8.0_102]
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[na:1.8.0_102]
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[na:1.8.0_102]
	at sun.nio.fs.UnixFileStore.devFor(UnixFileStore.java:57) ~[na:1.8.0_102]
	at sun.nio.fs.UnixFileStore.<init>(UnixFileStore.java:64) ~[na:1.8.0_102]
	at sun.nio.fs.BsdFileStore.<init>(BsdFileStore.java:40) ~[na:1.8.0_102]
	at sun.nio.fs.BsdFileSystemProvider.getFileStore(BsdFileSystemProvider.java:46) ~[na:1.8.0_102]
	at sun.nio.fs.BsdFileSystemProvider.getFileStore(BsdFileSystemProvider.java:34) ~[na:1.8.0_102]
	at sun.nio.fs.UnixFileSystemProvider.getFileStore(UnixFileSystemProvider.java:368) ~[na:1.8.0_102]
	at java.nio.file.Files.getFileStore(Files.java:1461) ~[na:1.8.0_102]
	at org.torproject.collector.cron.CollecTorMain.checkAvailableSpace(CollecTorMain.java:66) [collector-0.9.0-dev.jar:0.9.0-dev-f2d0cf0]
	at org.torproject.collector.relaydescs.ArchiveWriter.startProcessing(ArchiveWriter.java:121) [collector-0.9.0-dev.jar:0.9.0-dev-f2d0cf0]
	at org.torproject.collector.cron.CollecTorMain.run(CollecTorMain.java:42) [collector-0.9.0-dev.jar:0.9.0-dev-f2d0cf0]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_102]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_102]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_102]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_102]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_102]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_102]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_102]

Looks like a trivial bug in #18865.

Child Tickets

Change History (4)

comment:1 Changed 3 years ago by iwakeh

Owner: set to iwakeh
Status: newaccepted

Yes, that should be checked. Good catch!

comment:2 Changed 3 years ago by iwakeh

Status: acceptedneeds_review

Please review my branch.

Solution:
Now check the root of given path. That should always exist and be accessible. Any IOException here is a major problem and escalated via RuntimeException.

Added test for the problem and added some necessary test permissions.

comment:3 Changed 3 years ago by iwakeh

Priority: LowMedium

Increasing priority, so this floats near the top of the stack of reviews.

comment:4 Changed 3 years ago by karsten

Resolution: fixed
Status: needs_reviewclosed

Looks good, merged. Thanks! Closing.

Note: See TracTickets for help on using tickets.