zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maoling <...@git.apache.org>
Subject [GitHub] zookeeper pull request #336: ZOOKEEPER-2836: fix SocketTimeoutException
Date Fri, 18 Aug 2017 01:43:48 GMT
Github user maoling commented on a diff in the pull request:

    --- Diff: src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java ---
    @@ -647,11 +648,10 @@ public void run() {
                             numRetries = 0;
                     } catch (IOException e) {
    -                    if (shutdown) {
    -                        break;
    -                    }
                         LOG.error("Exception while listening", e);
    -                    numRetries++;
    +                    if (!(e instanceof SocketTimeoutException)) {
    --- End diff --
    -  can we reproduce this issue?(haha,49days)? This should never happen theoretically.According
to [KARAF-3325](https://issues.apache.org/jira/browse/KARAF-3325) or [tomcat-56684](https://bz.apache.org/bugzilla/show_bug.cgi?id=56684),they
also  didn't find the root-cause,just do like [this](https://github.com/apache/karaf/pull/50/commits/0349d582c4899f19ad73ee37c8c688660cbc7354)
to add some protections against this issue here.
    -  One assumption is SocketServer.accept() use the default infinite value(2 ^ 32 -1=4294967295)
without no timeout specified or setSoTimeout(0) 
        > a call to accept() for this ServerSocket will block for only this amount of time.
If the timeout expires, a java.net.SocketTimeoutException is raised, though the ServerSocket
is still valid. The option must be enabled prior to entering the blocking operation to have
effect. The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout.
       so this issuse always happended after 49days 17 hours(4294967295/1000/60/60/24=49.7days)

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message