Your message dated Fri, 15 Apr 2016 19:38:07 +0000
with message-id <[email protected]>
and subject line Bug#820703: Removed package(s) from unstable
has caused the Debian Bug report #717047,
regarding openjdk-7-jre-headless: ServerSocketChannel stays bound after close 
when selector waits for accept
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
717047: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=717047
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: openjdk-7-jre-headless
Version: 7u21-2.3.9-5
Severity: normal

When a ServerSocketChannel is bound to a port and a thread waits on a
selector for an accept on that channel, if the channel is closed by
another thread, it stays bound.

This problem seems kernel related since the channel is properly closed
with kernel version 3.2.0-4-amd64, but is not with kernel version
3.9-1-amd64.

The Java code below demonstrates the problem. When this code runs, the
listening socket can be monitored with

  watch -n 1 'netstat -n -l | grep 9080'

With kernel version 3.2.0-4-amd64, the listening socket disappears just
after the channel is closed. Whilst with kernel version 3.9-1-amd64, the
channel is closed only when the application terminates.

Interestingly, if instead of channel.close the shutdown C function
(sys/socket.h) is called via JNI by retrieving the underlying socket
file descriptor stored in the ServerSocketChannel, then the channel is
properly unbound. While if channel.close is called before shutdown, it
is not.

import java.net.InetSocketAddress;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.Selector;
import java.nio.channels.SelectionKey;
import java.util.Set;
import java.util.Iterator;

class shutdown {
    private static class MainSelector extends Thread {
        private final Selector selector;

        public MainSelector(Selector selector) {
            this.selector = selector;
        }

        public void run() {
            try {
                selector.select();

                Set<SelectionKey> keys = selector.selectedKeys();
                Iterator<SelectionKey> iterator = keys.iterator();
                SelectionKey key = iterator.next();

                if (key.isValid()) System.out.println("valid key");
                if (key.isAcceptable()) System.out.println("acceptable key");

                int readyOps = key.readyOps();
                key.interestOps(key.interestOps() & ~readyOps);

                keys.clear();
            } catch (Exception e) {
                System.out.println(e);
            }
        }
    }

    public static void main(String[] args) throws Exception {
        InetSocketAddress address = new InetSocketAddress("localhost", 9080);
        Selector selector = Selector.open();
        ServerSocketChannel channel = ServerSocketChannel.open();

        channel.configureBlocking(false);
        channel.bind(address);
        channel.register(selector, SelectionKey.OP_ACCEPT);

        Thread mainSelector = new MainSelector(selector);
        mainSelector.start();

        Thread.sleep(3000);
        System.out.println("close channel");
        channel.close();

        Thread.sleep(3000);
        mainSelector.interrupt();
    }
}

-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.9-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages openjdk-7-jre-headless depends on:
ii  ca-certificates-java  20121112+nmu2
ii  java-common           0.47
ii  libc6                 2.17-7
ii  libcups2              1.6.2-10
ii  libfontconfig1        2.10.2-2
ii  libfreetype6          2.4.9-1.1
ii  libgcc1               1:4.8.1-2
ii  libglib2.0-0          2.36.3-3
ii  libjpeg8              8d-1
ii  liblcms2-2            2.2+git20110628-2.2
ii  libnss3               2:3.15-1
ii  libpcsclite1          1.8.8-3
ii  libstdc++6            4.8.1-2
ii  multiarch-support     2.17-7
ii  openjdk-7-jre-lib     7u21-2.3.9-5
ii  tzdata-java           2013c-2
ii  zlib1g                1:1.2.8.dfsg-1

Versions of packages openjdk-7-jre-headless recommends:
pn  icedtea-7-jre-jamvm  <none>

Versions of packages openjdk-7-jre-headless suggests:
pn  fonts-ipafont-gothic               <none>
pn  fonts-ipafont-mincho               <none>
ii  libnss-mdns                        0.10-3.2
pn  sun-java6-fonts                    <none>
ii  ttf-dejavu-extra                   2.33+svn2514-3
pn  ttf-indic-fonts                    <none>
pn  ttf-wqy-microhei | ttf-wqy-zenhei  <none>

-- no debconf information

--- End Message ---
--- Begin Message ---
Version: 7u95-2.6.4-1+rm

Dear submitter,

as the package openjdk-7 has just been removed from the Debian archive
unstable we hereby close the associated bug reports.  We are sorry
that we couldn't deal with your issue properly.

For details on the removal, please see https://bugs.debian.org/820703

The version of this package that was in Debian prior to this removal
can still be found using http://snapshot.debian.org/.

This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
[email protected].

Debian distribution maintenance software
pp.
Scott Kitterman (the ftpmaster behind the curtain)

--- End Message ---

Reply via email to