You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "yekui (GitHub)" <gi...@apache.org> on 2018/10/22 07:24:13 UTC

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

2018-10-22 15:15:54,545 WARN [DubboSaveRegistryCache-thread-1] c.a.d.c.u.DubboLogger -  [DUBBO] Failed to save registry store file, cause: null, dubbo version: 3.2.0, current host: 10.1.122.68
java.nio.channels.OverlappingFileLockException: null
	at sun.nio.ch.SharedFileLockTable.checkList(FileLockTable.java:255)
	at sun.nio.ch.SharedFileLockTable.add(FileLockTable.java:152)
	at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:1108)
	at java.nio.channels.FileChannel.tryLock(FileChannel.java:1155)
	at com.alibaba.dubbo.registry.support.AbstractRegistry.doSaveProperties(AbstractRegistry.java:187)
	at com.alibaba.dubbo.registry.support.AbstractRegistry$SaveProperties.run(AbstractRegistry.java:146)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

[ 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


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

Posted by "beiwei30 (GitHub)" <gi...@apache.org>.
[ issue closed by beiwei30 ]

[ 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


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

Posted by "yekui (GitHub)" <gi...@apache.org>.
I have a few questions:
1. Why is emtpy protocol frequently registered
2. The empty protocol is generated when the provider does not exist
3. Why does the empty protocol also write to the cache
4. Why is there a unified empty agreement and triggered concurrently?

[ 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


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

Posted by "cvictory (GitHub)" <gi...@apache.org>.
can you upload a demo so that we can reproduce the issue.

The demo can directly redisplay the issue.

[ 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


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

Posted by "beiwei30 (GitHub)" <gi...@apache.org>.
@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