Skip to content

Commit 18601a9

Browse files
mksahakyankhys95
authored andcommitted
pool:fix outofspace error sending pool into diasbled mode
Motivation we are seeing the this error wen there is no space on the pool left, and pool goes into disabled mode, AB56598C55] WRITE failed : IOError AB56598C55] Transfer failed due to a disk error: CacheException(rc=204;msg=Disk I/O Error ) AB56598C55] Pool mode changed to disabled(fetch,store,stage,p2p-client,p2p-server): Pool disabled: Disk I/O Error AB56598C55] Pool: dcache-xfel487-01, fault occurred in transfer: Disk I/O Error . Pool disabled: , cause: CacheException(rc=204;msg=Disk I/O Error ) however we want it to go into READ-ONLY mode and files could stay accesable. the privous patch (https://rb.dcache.org/r/14357/diff/3/#index_header) did not fix the issue. so the new changes are still a try to fix the issue. Acked-by: Dmitry Litvintsev Target: master. 10.2, 10.1, 10.0, 9.2 Require-book: no Require-notes: yes Patch: https://rb.dcache.org/r/14368/
1 parent d2bbc9f commit 18601a9

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

modules/dcache-dcap/src/main/java/org/dcache/pool/movers/DCapProtocol_3_nio.java

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,12 @@ public void runIO(FileAttributes fileAttributes,
367367
String errmsg = "WRITE failed : " + (ioException == null ? "IOError"
368368
: Exceptions.messageOrClassName(ioException));
369369
int rc;
370-
if (ioException instanceof OutOfDiskException) {
370+
// TODO: To be checked (in production) if the error is an IOException;
371+
// we can check it only by the error message.
372+
if (ioException instanceof OutOfDiskException ||
373+
(ioException != null && ioException.getCause().getMessage()
374+
.contains("No space available."))
375+
) {
371376
_log.debug(errmsg);
372377
rc = CacheException.RESOURCE;
373378
} else {
@@ -535,7 +540,11 @@ public void runIO(FileAttributes fileAttributes,
535540
"SEEK_AND_WRITE failed : " + (ioException == null ? "IOError"
536541
: Exceptions.messageOrClassName(ioException));
537542
int rc;
538-
if (ioException instanceof OutOfDiskException) {
543+
// TODO: To be checked (in production) if the error is an IOException;
544+
// we can check it only by the error message.
545+
if (ioException instanceof OutOfDiskException ||
546+
(ioException != null && ioException.getCause().getMessage()
547+
.contains("No space available."))) {
539548
_log.debug(errmsg);
540549
rc = CacheException.RESOURCE;
541550
} else {
@@ -678,10 +687,19 @@ public void runIO(FileAttributes fileAttributes,
678687
if (ioException instanceof OutOfDiskException) {
679688
throw ioException;
680689
} else {
681-
throw new
682-
DiskErrorCacheException(
683-
"Disk I/O Error " +
684-
(ioException != null ? ioException.toString() : ""));
690+
//TODO since the OutOfDiskException is not catched the error ist IOexception
691+
// this is a workaround
692+
if (ioException != null && ioException.getCause().getMessage().contains("No space available.")) {
693+
throw new
694+
OutOfDiskException(
695+
"No space available." +
696+
ioException.toString());
697+
} else {
698+
throw new
699+
DiskErrorCacheException(
700+
"Disk I/O Error " +
701+
(ioException != null ? ioException.toString() : ""));
702+
}
685703
}
686704
} else {
687705
if (ioException != null && !(ioException instanceof EOFException)) {
@@ -922,6 +940,7 @@ private void doTheWrite(RepositoryChannel fileChannel,
922940
// clear interrupted state
923941
Thread.interrupted();
924942
throw new InterruptedException(ee.getMessage());
943+
// TODO: In the case of a "no space left" error message, this will not work.
925944
} catch (OutOfDiskException e) {
926945
_io_ok = false;
927946
ioException = e;

modules/dcache/src/main/java/org/dcache/pool/classic/MoverRequestScheduler.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.dcache.pool.movers.Mover;
4242
import org.dcache.pool.movers.json.MoverData;
4343
import org.dcache.pool.repository.FileStore;
44+
import org.dcache.pool.repository.OutOfDiskException;
4445
import org.dcache.util.AdjustableSemaphore;
4546
import org.dcache.util.IoPrioritizable;
4647
import org.dcache.util.IoPriority;
@@ -527,6 +528,13 @@ public void failed(Throwable exc, Void attachment) {
527528
FaultEvent faultEvent = new FaultEvent("transfer",
528529
faultAction, exc.getMessage(), exc);
529530
_faultListeners.forEach(l -> l.faultOccurred(faultEvent));
531+
} else if (exc instanceof OutOfDiskException) {
532+
FaultEvent faultEvent = new FaultEvent(
533+
"post-processing",
534+
FaultAction.READONLY,
535+
exc.getMessage(), exc);
536+
_faultListeners.forEach(
537+
l -> l.faultOccurred(faultEvent));
530538
}
531539
postprocess();
532540
}
@@ -558,6 +566,13 @@ public void failed(Throwable exc, Void attachment) {
558566
exc.getMessage(), exc);
559567
_faultListeners.forEach(
560568
l -> l.faultOccurred(faultEvent));
569+
} else if (exc instanceof OutOfDiskException) {
570+
FaultEvent faultEvent = new FaultEvent(
571+
"post-processing",
572+
FaultAction.READONLY,
573+
exc.getMessage(), exc);
574+
_faultListeners.forEach(
575+
l -> l.faultOccurred(faultEvent));
561576
}
562577
release();
563578
}

0 commit comments

Comments
 (0)