Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgJDBC - StatementTest hangs in Windows 7 / 2012 / 2016 #1406

Merged
merged 1 commit into from Feb 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -882,6 +882,7 @@ public Void call() throws Exception {
e.getSQLState()
);
cancels++;
break;
Copy link
Member

@vlsi vlsi Feb 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jajalvipul , can you please clarify why the test takes so long to finish?

Apparently it was supposed to be a fast test, so I'm curious what are the threads doing if the test takes 100 seconds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vlsi

Yes, you are right that cancellation work "immediately" but seems to be in Linux environment.
The cancellation does work in Windows platform but it is not as fast as compared to Linux platform.

In Windows platforms, while running the JDBC tests, it has been observed the cancellation work but it starts to slow down with every iteration in the for loop present in the method StatementTest#testCloseInProgressStatement. And eventually it exceeds the JUnit timeout (10 sec) set for this method.

Most of the times, the JUnit timeout was exceeding, terminating the test method execution. This was resulting in hang issue at the TestUtil.dropTable(con, "test_lock"); in tearDown().

Couple of times, following exception 'IllegalStateException' was also encountered, resulting in hang issue as mentioned above.

         public Void call() throws Exception {
            long start = System.currentTimeMillis();
            while (st.getWarnings() == null) {
              long dt = System.currentTimeMillis() - start;
              if (dt > 10000) {
                throw new IllegalStateException("Expected to receive a notice within 10 seconds");
              }
            }
            st.close();
            return null;
          }

} finally {
TestUtil.closeQuietly(st);
}
Expand Down