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 8946323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:28:51+00:00 2026-06-15T12:28:51+00:00

I have a multithreaded program that’s supposed to run 24/7, sometimes I would see

  • 0

I have a multithreaded program that’s supposed to run 24/7, sometimes I would see a few threads would just hang after some time the program runs, no exception or error. It just would not do anything. I ran a thread dump to see what the problem and this is the related threaddump for the thread which was not doing anything

"Thread2" prio=6 tid=0x0000000014814000 nid=0xbf8 runnable [0x00000000159fe000]
   java.lang.Thread.State: RUNNABLE
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(Unknown Source)
        at java.net.SocketInputStream.read(Unknown Source)
        at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:143)
        at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:112)
        at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:71)
        at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:272)
        at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:269)
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:106)
        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)
        at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:123)
        at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:28)
        at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:20)
        at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:30)
        at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:22)
        at org.postgresql.Driver.makeConnection(Driver.java:391)
        at org.postgresql.Driver.connect(Driver.java:265)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at database.Database.isItInDatabase(Database.java:1108)
        at miner.Miner.run(Miner.java:145)
        at java.lang.Thread.run(Unknown Source)

and below is the Database method

public Boolean isItInDatabase(String userName) throws SQLException
{
    Connection conn = null;
    PreparedStatement pst = null;
    ResultSet rs = null;
    Boolean exists = false;

    try
    {
        Class.forName("org.postgresql.Driver");
        conn = DriverManager.getConnection("jdbc:postgresql://MYSERVERIP:5432/" + database, username, password); //--->>>>>>line 1108
        pst = conn.prepareStatement("SELECT COUNT(*) FROM listing_info where listing_url = ?");
        pst.setString(1, userName);

        rs = pst.executeQuery();
        while (rs.next())
        {
            exists = rs.getBoolean(1);
        }

    }
    catch (Exception e)
    {
        System.out.println(e);
    }
    finally
    {
        pst.close();
        rs.close();
        conn.close();
    }

    return exists;
}

I have marked where line 1108 is in my Database file. Is there anything I can do to fix this issue? so the program does not wait there forever?

  • 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-06-15T12:28:52+00:00Added an answer on June 15, 2026 at 12:28 pm

    That has nothing to do with databases. that is a hung socket connection. it happens when the socket connection gets broken. the only way to stop it from hanging is to use socket read timeouts. looks like there are some jdbc driver config properties for postgresql which will fix the issue.

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

Sidebar

Related Questions

I have a multithreaded openCV program that uses 4 threads to do the following:
I have a multithreaded program which uses pthread mutexes for synchronization on few integers.
When I run a single-threaded program that i have written on my quad core
I have a multithreaded java program that runs on Amazon's EC2. It queries and
Situation: I have a multithreaded program written in C. If one of the threads
I have a program that is performing waaaay under par, and I would like
I have a multithreaded program running which crashes after a day or two. Moreover
I have a multithreaded server C++ program that uses MSXML6 and continuously parses XML
Let's say I have a multithreaded C++ program that handles requests in the form
I have a large multithreaded C# program in development that loads multiple DLLs from

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.