Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6324693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:45:11+00:00 2026-05-24T16:45:11+00:00

We have a http server which is implemented based on Java NIO. It is

  • 0

We have a http server which is implemented based on Java NIO.
It is running on Ubuntu 10.04.2 LTS with java version “1.6.0_20”
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Server VM (build 16.3-b01, mixed mode)

However, it leaks file descriptors, all of them are unix domain sockets.

When use the command “netstat -anp”, we can find that the process only opens two unix domain socket.
However, when use lsof -p , we can find that there are huge amounts of file descriptors which are unix domain socket and have the same device value and node value as the one find in netstat.

I have checked our code, and all of the SocketChannels are closed properly.

Is it a bug of Sun JDK?
How can we fix it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T16:45:12+00:00Added an answer on May 24, 2026 at 4:45 pm

    The root cause is found.
    In our code, when we close socketchannel, we also cancel the key. The problem is that:
    a. We cancel the key in the select thread, and close the socketchannel in another thread
    b. The socket channel is closed until the key.cancel is invoked.

    By reading the implementation of close and cancel, we can find that the unix domain socket is opened by dup2 and never closed some times (concurrent issue).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an HTTP server which is in our internal network and accessible only
I have a web server which is protected behind http-basic-auth. I've read through the
I have a thread which handles all the HTTP Connections to the server and
I have my Apache http server running on localhost:80 and restlet server on localhost:8182,
I am running a HTTP server on my development machine. I have a website,
I have a method, which connects to a HTTP server and requests via XMLRPC,
I have an HTTP server that returns large bodies in response to POST requests
I have a python script that is a http-server: http://paste2.org/p/89701 , when benchmarking it
I have some pdf files located on a http server: Like: http://domain.com/files/file1.pdf http://domain.com/files/file1.pdf http://domain.com/files/file1.pdf
I have a small app that downloads some files from a remote (HTTP) server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.