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

Conversation

@jajalvipul
Copy link
Contributor

@jajalvipul jajalvipul commented Feb 4, 2019

This has resulted in avoiding the hang issue identified in issue #1403

All Submissions:

  • [*] Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Existing Features:

  • [*] Have you added an explanation of what your changes do and why you'd like us to include them?
  • [*] Have you successfully run tests with your changes locally?
This has resulted in avoiding the hang issue identified in issue # 1403
@jajalvipul jajalvipul changed the title Added break statement to avoid the additional iterations in for loop pgJDBC - StatementTest hangs in Windows 7 / 2012 / 2016 #1403 Feb 4, 2019
@jajalvipul jajalvipul changed the title pgJDBC - StatementTest hangs in Windows 7 / 2012 / 2016 #1403 pgJDBC - StatementTest hangs in Windows 7 / 2012 / 2016 Feb 4, 2019
@AppVeyorBot
Copy link

@AppVeyorBot AppVeyorBot commented Feb 4, 2019

@codecov-io
Copy link

@codecov-io codecov-io commented Feb 4, 2019

Codecov Report

Merging #1406 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master   #1406      +/-   ##
===========================================
- Coverage     68.72%   68.7%   -0.02%     
  Complexity     3894    3894              
===========================================
  Files           179     179              
  Lines         16394   16394              
  Branches       2668    2668              
===========================================
- Hits          11266   11264       -2     
- Misses         3880    3882       +2     
  Partials       1248    1248

@davecramer davecramer merged commit 6b13f7b into pgjdbc:master Feb 4, 2019
2 of 3 checks passed
@@ -882,6 +882,7 @@ public Void call() throws Exception {
e.getSQLState()
);
cancels++;
break;
Copy link
Member

@vlsi vlsi Feb 4, 2019

@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

@jajalvipul jajalvipul Feb 6, 2019

@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;
          }

davecramer added a commit to davecramer/pgjdbc that referenced this issue Jul 5, 2021
…gjdbc#1406)

This has resulted in avoiding the hang issue identified in issue # 1403
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants