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

Cooperate/Respect Interrupts #196

Closed
jschulist opened this issue Mar 13, 2017 · 3 comments
Closed

Cooperate/Respect Interrupts #196

jschulist opened this issue Mar 13, 2017 · 3 comments
Assignees
Projects

Comments

@jschulist
Copy link

Encountered a situation where a piece of code was calling cancel(true) on a future runnable but upon inspection Thead.currentThead().isInterrupted() was returning false inside the runnable. The problem is this runnable communicates with sql and the interrupt status/flag is being removed/swallowed by the driver. Specifically the path I encountered was in the login method of SqlServerConnection. The method is using Thead.sleep and is swallowing the InterruptedException. Because Thead.sleep throws InterruptedException when it encounters an interrupt it clears the interrupt status/flag. When execution ultimately returns to the runnable it has no knowledge that an interrupt ever occurred making it impossible for it to act on it. The driver doesn't necessarily need to halt it's execution but in my opinion it should not hide the fact that interrupt occurred.

I'm certainly no expert when it comes to java threading so I'll defer to guidance provided by IBM: https://www.ibm.com/developerworks/library/j-jtp05236/

NOTE: From a quick look through the codebase this is not the only area of concern

@xiangyushawn
Copy link
Contributor

@jschulist Thank you for finding the issue. We created a PR for it to restore the thread's interrupt status. We hope this will work for you. Thank you.

@xiangyushawn xiangyushawn added the Waiting for Response Waiting for a reply from the original poster, or affiliated party label Mar 22, 2017
@jschulist
Copy link
Author

Thanks, the PR LGTM.

@xiangyushawn
Copy link
Contributor

@jschulist Thank you for getting back to us. I am closing the issue.

@v-nisidh v-nisidh removed the Waiting for Response Waiting for a reply from the original poster, or affiliated party label Apr 26, 2017
@lilgreenbird lilgreenbird added this to Closed Issues in MSSQL JDBC Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
MSSQL JDBC
  
Closed Issues
Development

No branches or pull requests

3 participants