Search in sources :

Example 1 with TimeoutCacheException

use of diskCacheV111.util.TimeoutCacheException in project dcache by dCache.

the class ConsistentReplicaStore method get.

/**
 * Retrieves a CacheRepositoryEntry from the wrapped meta data store. If the entry is missing or
 * fails consistency checks, the entry is reconstructed with information from PNFS.
 */
@Override
public ReplicaRecord get(PnfsId id) throws IllegalArgumentException, CacheException {
    ReplicaRecord entry = _replicaStore.get(id);
    if (entry != null && isBroken(entry)) {
        LOGGER.warn("Recovering {}...", id);
        try {
            /* It is safe to remove FROM_STORE/FROM_POOL replicas: We have
                 * another copy anyway. Files in REMOVED or DESTROYED
                 * were about to be deleted, so we can finish the job.
                 */
            switch(entry.getState()) {
                case FROM_POOL:
                case FROM_STORE:
                case REMOVED:
                case DESTROYED:
                    _replicaStore.remove(id);
                    _pnfsHandler.clearCacheLocation(id);
                    LOGGER.info("Recovering: Removed {} because it was not fully staged.", id);
                    return null;
            }
            entry = rebuildEntry(entry);
        } catch (IOException e) {
            throw new DiskErrorCacheException("I/O error in healer: " + messageOrClassName(e), e);
        } catch (FileNotFoundCacheException e) {
            _replicaStore.remove(id);
            LOGGER.warn("Recovering: Removed {} because name space entry was deleted.", id);
            return null;
        } catch (FileIsNewCacheException e) {
            _replicaStore.remove(id);
            LOGGER.warn("Recovering: Removed {}: {}", id, e.getMessage());
            return null;
        } catch (TimeoutCacheException e) {
            throw e;
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new CacheException("Pool is shutting down", e);
        } catch (CacheException | NoSuchAlgorithmException e) {
            entry.update("Failed to recover replica: " + e.getMessage(), r -> r.setState(ReplicaState.BROKEN));
            LOGGER.error(AlarmMarkerFactory.getMarker(PredefinedAlarm.BROKEN_FILE, id.toString(), _poolName), "Marked {} bad: {}.", id, e.getMessage());
        }
    }
    return entry;
}
Also used : AlarmMarkerFactory(org.dcache.alarms.AlarmMarkerFactory) ReplicaStatePolicy(org.dcache.pool.classic.ReplicaStatePolicy) FileIsNewCacheException(diskCacheV111.util.FileIsNewCacheException) AccessLatency(diskCacheV111.util.AccessLatency) PredefinedAlarm(org.dcache.alarms.PredefinedAlarm) LoggerFactory(org.slf4j.LoggerFactory) Exceptions.messageOrClassName(org.dcache.util.Exceptions.messageOrClassName) DiskErrorCacheException(diskCacheV111.util.DiskErrorCacheException) RETENTION_POLICY(org.dcache.namespace.FileAttribute.RETENTION_POLICY) PnfsHandler(diskCacheV111.util.PnfsHandler) CacheException(diskCacheV111.util.CacheException) Iterables.concat(com.google.common.collect.Iterables.concat) SIZE(org.dcache.namespace.FileAttribute.SIZE) FileNotFoundCacheException(diskCacheV111.util.FileNotFoundCacheException) EnumSet(java.util.EnumSet) ChecksumModule(org.dcache.pool.classic.ChecksumModule) FileAttributes(org.dcache.vehicles.FileAttributes) STORAGEINFO(org.dcache.namespace.FileAttribute.STORAGEINFO) PnfsId(diskCacheV111.util.PnfsId) Logger(org.slf4j.Logger) OpenOption(java.nio.file.OpenOption) LOCATIONS(org.dcache.namespace.FileAttribute.LOCATIONS) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException) Set(java.util.Set) IOException(java.io.IOException) Sets(com.google.common.collect.Sets) Checksum(org.dcache.util.Checksum) List(java.util.List) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) FileAttribute(org.dcache.namespace.FileAttribute) Collections(java.util.Collections) ACCESS_LATENCY(org.dcache.namespace.FileAttribute.ACCESS_LATENCY) CHECKSUM(org.dcache.namespace.FileAttribute.CHECKSUM) RetentionPolicy(diskCacheV111.util.RetentionPolicy) FileIsNewCacheException(diskCacheV111.util.FileIsNewCacheException) DiskErrorCacheException(diskCacheV111.util.DiskErrorCacheException) CacheException(diskCacheV111.util.CacheException) FileNotFoundCacheException(diskCacheV111.util.FileNotFoundCacheException) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException) FileNotFoundCacheException(diskCacheV111.util.FileNotFoundCacheException) FileIsNewCacheException(diskCacheV111.util.FileIsNewCacheException) IOException(java.io.IOException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) DiskErrorCacheException(diskCacheV111.util.DiskErrorCacheException) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException)

Example 2 with TimeoutCacheException

use of diskCacheV111.util.TimeoutCacheException in project dcache by dCache.

the class XrootdRedirectHandler method doOnStatx.

@Override
protected XrootdResponse<StatxRequest> doOnStatx(ChannelHandlerContext ctx, StatxRequest req) throws XrootdException {
    if (req.getPaths().length == 0) {
        throw new XrootdException(kXR_ArgMissing, "no paths specified");
    }
    try {
        FsPath[] paths = new FsPath[req.getPaths().length];
        for (int i = 0; i < paths.length; i++) {
            paths[i] = createFullPath(req.getPaths()[i]);
        }
        LoginSessionInfo loginSessionInfo = sessionInfo();
        Subject subject = loginSessionInfo.getSubject();
        Restriction restriction = loginSessionInfo.getRestriction();
        return new StatxResponse(req, _door.getMultipleFileStatuses(paths, subject, restriction));
    } catch (TimeoutCacheException e) {
        throw xrootdException(e.getRc(), "Internal timeout");
    } catch (PermissionDeniedCacheException e) {
        throw xrootdException(e);
    } catch (CacheException e) {
        throw xrootdException(e.getRc(), String.format("Failed to open file (%s [%d])", e.getMessage(), e.getRc()));
    }
}
Also used : Restriction(org.dcache.auth.attributes.Restriction) PermissionDeniedCacheException(diskCacheV111.util.PermissionDeniedCacheException) FileIsNewCacheException(diskCacheV111.util.FileIsNewCacheException) FileExistsCacheException(diskCacheV111.util.FileExistsCacheException) FileNotFoundCacheException(diskCacheV111.util.FileNotFoundCacheException) NotFileCacheException(diskCacheV111.util.NotFileCacheException) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException) CacheException(diskCacheV111.util.CacheException) PermissionDeniedCacheException(diskCacheV111.util.PermissionDeniedCacheException) StatxResponse(org.dcache.xrootd.protocol.messages.StatxResponse) XrootdException(org.dcache.xrootd.core.XrootdException) Subject(javax.security.auth.Subject) FsPath(diskCacheV111.util.FsPath) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException)

Example 3 with TimeoutCacheException

use of diskCacheV111.util.TimeoutCacheException in project dcache by dCache.

the class UserAdminShell method checkPermission.

/**
 * Checks that the current effective user has the given acl.
 *
 * @throws AclException if the current user does not have the given {@code aclName}
 */
public void checkPermission(String aclName) throws AclException {
    Object[] request = new Object[5];
    request[0] = "request";
    request[1] = "<nobody>";
    request[2] = "check-permission";
    request[3] = getUser();
    request[4] = aclName;
    Object[] r;
    try {
        r = _acmStub.sendAndWait(request, Object[].class);
    } catch (TimeoutCacheException | NoRouteToCellException e) {
        throw new AclException(e.getMessage());
    } catch (CacheException | InterruptedException e) {
        throw new AclException("Problem: " + e.getMessage());
    }
    if (r.length < 6 || !(r[5] instanceof Boolean)) {
        throw new AclException("Protocol violation 4456");
    }
    if (!((Boolean) r[5])) {
        throw new AclException(getUser(), aclName);
    }
}
Also used : TimeoutCacheException(diskCacheV111.util.TimeoutCacheException) CacheException(diskCacheV111.util.CacheException) NoRouteToCellException(dmg.cells.nucleus.NoRouteToCellException) AclException(dmg.util.AclException) CommandAclException(dmg.util.CommandAclException) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException)

Example 4 with TimeoutCacheException

use of diskCacheV111.util.TimeoutCacheException in project dcache by dCache.

the class HttpBillingEngine method printMainStatisticsPage.

private void printMainStatisticsPage(OutputStream out) throws HttpException {
    HTMLWriter html = new HTMLWriter(out, _context);
    try {
        Object[][] x = _billing.sendAndWait("get billing info", Object[][].class);
        html.addHeader("/styles/billing.css", "dCache Billing");
        printTotalStatistics(html, x);
        try {
            Map<String, long[]> map = _billing.sendAndWait("get pool statistics", Map.class);
            printPoolStatistics(html, map, null);
        } catch (InterruptedException | TimeoutCacheException e) {
            throw e;
        } catch (CacheException e) {
            html.print("<p class=\"error\">This 'billingCell' doesn't support: 'get pool statistics':");
            html.print("<blockquote><pre>" + e + "</pre></blockquote>");
        }
    } catch (NoRouteToCellException e) {
        throw new HttpException(500, "No connection to billing");
    } catch (TimeoutCacheException e) {
        throw new HttpException(500, "Request Timed Out");
    } catch (InterruptedException | CacheException e) {
        throw new HttpException(500, "Problem : " + e.getMessage());
    } finally {
        html.addFooter(getClass().getName());
    }
}
Also used : HTMLWriter(diskCacheV111.util.HTMLWriter) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException) CacheException(diskCacheV111.util.CacheException) NoRouteToCellException(dmg.cells.nucleus.NoRouteToCellException) HttpException(dmg.util.HttpException) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException)

Example 5 with TimeoutCacheException

use of diskCacheV111.util.TimeoutCacheException in project dcache by dCache.

the class HttpPoolMgrEngineV3 method showMatch.

private void showMatch(PrintWriter pw, HttpRequest request) throws NoRouteToCellException, InterruptedException {
    String type = request.getParameter(PARAMETER_TYPE);
    String store = request.getParameter(PARAMETER_STORE);
    String dcache = request.getParameter(PARAMETER_DCACHE);
    String net = request.getParameter(PARAMETER_NET);
    String prot = request.getParameter(PARAMETER_PROTOCOL);
    String linkGroup = request.getParameter(PARAMETER_LINKGROUP);
    linkGroup = (linkGroup == null) || (linkGroup.isEmpty()) ? "none" : linkGroup;
    store = (store == null) || (store.isEmpty()) ? "*" : store;
    dcache = (dcache == null) || (dcache.isEmpty()) ? "*" : dcache;
    net = (net == null) || (net.isEmpty()) ? "*" : net;
    prot = (prot == null) || (prot.isEmpty()) ? "*" : prot;
    pw.println("<center>");
    if (type == null) {
        showQueryForm(pw, "none", "read", "*", "*", "*", "DCap/3");
    } else {
        showQueryForm(pw, linkGroup, type, store, dcache, net, prot);
        pw.println("<p><hr><p>");
        try {
            PoolPreferenceLevel[] result = _poolManager.sendAndWait("psux match " + type + " " + store + " " + dcache + " " + net + " " + prot + (linkGroup.equals("none") ? "" : " -linkGroup=" + linkGroup), PoolPreferenceLevel[].class);
            for (int i = 0; i < result.length; i++) {
                pw.print("<p><h2>Selected Pools with attraction " + i);
                String tag = result[i].getTag();
                if (tag != null) {
                    pw.print(" (dCache subsection=" + tag + ")");
                }
                pw.println("</h2>");
                showList(pw, result[i].getPoolList().toArray(), 8, "/poolInfo/pools/");
            }
        } catch (TimeoutCacheException e) {
            showTimeout(pw);
        } catch (CacheException e) {
            showProblem(pw, e.getMessage());
        }
    }
    pw.println("</center>");
}
Also used : CacheException(diskCacheV111.util.CacheException) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException) CellEndpoint(dmg.cells.nucleus.CellEndpoint) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException)

Aggregations

TimeoutCacheException (diskCacheV111.util.TimeoutCacheException)44 CacheException (diskCacheV111.util.CacheException)42 FileNotFoundCacheException (diskCacheV111.util.FileNotFoundCacheException)25 PermissionDeniedCacheException (diskCacheV111.util.PermissionDeniedCacheException)25 FileExistsCacheException (diskCacheV111.util.FileExistsCacheException)20 FileIsNewCacheException (diskCacheV111.util.FileIsNewCacheException)18 NotDirCacheException (diskCacheV111.util.NotDirCacheException)17 FileCorruptedCacheException (diskCacheV111.util.FileCorruptedCacheException)15 NoRouteToCellException (dmg.cells.nucleus.NoRouteToCellException)15 SRMException (org.dcache.srm.SRMException)15 SRMInternalErrorException (org.dcache.srm.SRMInternalErrorException)15 FsPath (diskCacheV111.util.FsPath)14 SRMAuthorizationException (org.dcache.srm.SRMAuthorizationException)11 Subject (javax.security.auth.Subject)10 SRMInvalidPathException (org.dcache.srm.SRMInvalidPathException)10 PnfsHandler (diskCacheV111.util.PnfsHandler)8 Restriction (org.dcache.auth.attributes.Restriction)7 FileAttributes (org.dcache.vehicles.FileAttributes)7 NotFileCacheException (diskCacheV111.util.NotFileCacheException)6 InetSocketAddress (java.net.InetSocketAddress)4