You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "beiwei30 (GitHub)" <gi...@apache.org> on 2018/10/29 09:28:51 UTC

[GitHub] [incubator-dubbo] beiwei30 commented on issue #2673: dubbo throws Failed to save registry store file, cause java.nio.channels.OverlappingFileLockException

@yukui, let me try to answer your questions. Basically you are asking two things:

1. why OverlappingFileLockException happens
1.  why `empty://` URLs appear in the cache

For question one, it looks like there are two or more threads contend for the file lock, for this, you can simple ignore, since eventually all contents will be updated into the cache file. If you are curious about why it happens, you can check [here](https://stackoverflow.com/questions/9906161/why-does-overlappingfilelockexception-happen-when-locking-a-file), and javadoc I quote below:

```java
    /**
     * Attempts to acquire an exclusive lock on this channel's file.
     *
     * <p> An invocation of this method of the form <tt>fc.tryLock()</tt>
     * behaves in exactly the same way as the invocation
     *
     * <pre>
     *     fc.{@link #tryLock(long,long,boolean) tryLock}(0L, Long.MAX_VALUE, false) </pre>
     *
     * @return  A lock object representing the newly-acquired lock,
     *          or <tt>null</tt> if the lock could not be acquired
     *          because another program holds an overlapping lock
     *
     * @throws  ClosedChannelException
     *          If this channel is closed
     *
     * @throws  OverlappingFileLockException
     *          If a lock that overlaps the requested region is already held by
     *          this Java virtual machine, or if another thread is already
     *          blocked in this method and is attempting to lock an overlapping
     *          region
     *
     * @throws  IOException
     *          If some other I/O error occurs
     *
     * @see     #lock()
     * @see     #lock(long,long,boolean)
     * @see     #tryLock(long,long,boolean)
     */
    public final FileLock tryLock() throws IOException {
        return tryLock(0L, Long.MAX_VALUE, false);
    }
```

For question two, most likely the `empty://` URLs you see in the cache file are fallen into two categories, which are 'configurator' and 'router'. This is because your Dubbo application doesn't have configuration and routing rule configured on ZooKeeper.

For example:

* empty\://30.5.124.88/org.apache.dubbo.samples.api.GreetingService?application\=demo-consumer&**category\=configurators**&default.timeout\=3000&dubbo\=2.0.2&interface\=org.apache.dubbo.samples.api.GreetingService&methods\=sayHello&pid\=19160&side\=consumer&timestamp\=1540802240362
* empty\://30.5.124.88/org.apache.dubbo.samples.api.GreetingService?application\=demo-consumer&**category\=routers**&default.timeout\=3000&dubbo\=2.0.2&interface\=org.apache.dubbo.samples.api.GreetingService&methods\=sayHello&pid\=19160&side\=consumer&timestamp\=1540802240362 
* dubbo\://30.5.124.88\:20880/org.apache.dubbo.samples.api.GreetingService?anyhost\=true&application\=demo-provider&dubbo\=2.0.2&generic\=false&interface\=org.apache.dubbo.samples.api.GreetingService&methods\=sayHello&pid\=18822&side\=provider&timestamp\=1540802229289 
* empty\://30.5.124.88/org.apache.dubbo.samples.api.GreetingService?application\=demo-consumer&**category\=providers,configurators,routers**&default.timeout\=3000&dubbo\=2.0.2&interface\=org.apache.dubbo.samples.api.GreetingService&methods\=sayHello&pid\=19160&side\=consumer&timestamp\=1540802240362

I hope this answers your questions. If you have further comments/questions on this topic, welcome to discuss with us on dev@dubbo.apache.org

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2673 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org