-
Notifications
You must be signed in to change notification settings - Fork 32
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
poolCheckout Causing Authentication Errors on DB2 Server #133
Comments
Do the failing queries look like this? Lines 40 to 46 in 00fad2c
If so, you can fix this by giving |
We are not seeing a specific query that failed. It simply logs the IP address of the Workbench or Connect server, the username, and the database/tables attempting to be accessed. However, I was using "VALUES 1", then switched to "SELECT 1 FROM SYSIBM.SYSDUMMY1". I had the same issue with both. I just changed the validateQuery to select a column from a table that the account for sure has access to, but we still got authentication errors when I ran poolCheckout(). |
If I'm understanding this right, Given that the issue only happens when you start the initial connection and not on subsequent queries, I'm thinking that it occurs when |
Just to be clear, you're not seeing any errors on the R side? Only in the logs for the database server? |
Correct. R is not returning any errors about authentication issues. The db2 server is showing the authentication attempts on everything, regardless of the user's access rights to those databases/tables. |
Random thought: are you using RStudio? Is it the connection pane that's causing the problem by attempting to get information about all accessible tables? |
Yes, we are using Workbench. If the connection pane is attempting to get information about all tables repeatedly, that could be it. I don't see the issue when I run a connection without pool in the R script itself. I suppose when I do that, it does not actually create the connection in the connection pane. However, when I do that using the pool package, maybe it also opens it up in the connection pane automatically? If that is the case and this is an RStudio/Workbench issue, is there something that would need to be adjusted to prevent the connection pane from trying to get information about tables that my login should not have access to? Would that be on the RStudio side or potentially something that my DBA would need to look at? |
Can you see the db2 connection in the connections pane? If you can't, it's probably something else. (And I don't see that pool does anything special to register connections so this might be a red herring). Otherwise, I can't see any pool code that lists tables or otherwise queries the database, so unless you can somehow give us a reprex that we can run, unfortunately I don't think there's much chance we can figure out the root cause. |
When I run the dbPool command, it does not open the connection in the connection pane. Furthermore, I tried a normal connection in the connection pane using DBI::dbConnect() which did not cause the same authentication failures we were seeing before, so it can't be the connection pane itself. I'm still not sure the difference between the connection that dbPool then poolCheckout creates versus the one that dbConnect creates, but we only have issues with the former, and not the latter. I'm not sure how to give a reprex in this instance, unfortunately, but do know that the issue has only been seen when using the pool package for connections. |
There is no difference in the connection; So unfortunately because this bug so hard for us to reproduce, we don't have the development resources to fix at this time. It's our policy to close such issues to help stay focussed on the biggest problems, but the issue is still indexed by google, so if other people hit it, they'll be able to find it, and we can consider reopen it if it turns out to be a common problem. Thanks for reporting and I'm sorry we couldn't help more 😞. |
@hadley I'm sorry for bringing this issue back up so quickly after last week's discussion, but I have more info at this point. We have been following up internally and with IBM. As part of the troubleshooting, we started an ODBC trace. When I run That doesn't actually tell poolCheckout to only use the validateQuery statement. I am seeing in the trace that the function is still looping through these statements: Lines 39 to 49 in cfe18af
It times out on "Select * from INFORMATION_SCHEMA.TABLES", which I confirmed is the specific statement causing the authentication failures. It appears to me that this part of the code is failing, since it is not seeing the Lines 28 to 35 in cfe18af
I'm hoping that this provides enough additional clarity around the issue that we can re-open the case and figure out a fix. |
Hmmm yeah, |
* Correctly access pool metadata, respecting `validateQuery` and ensuring cache actually works. * Validate on creation to ensure problems are revealed as soon as possible. Fixes #133
@michaelbonilla can you please restart R and then try |
That appears to have worked. I tested two things:
At least for those running DB2, it may be beneficial to switch the order of the validation queries to place |
Does |
Yes, that works much better. I talked to the system admin and we were still seeing the authentication errors before, but adding the Thank you so much for your help solving this issue! I'll look forward to the updated package being available on CRAN. |
Thanks for persisting so we could get to the source of the problem! The fix should also generally improve performance for folks using pool 😄 |
* Correctly access pool metadata, respecting `validateQuery` and ensuring cache actually works. * Validate on creation to ensure problems are revealed as soon as possible. * Review and better comment validation query options. Fixes #133
I am trying to troubleshoot an issue here that I have isolated to occurring when poolCheckout() is run.
I am using pool to setup a connection to a DB2 server. The connection becomes active and valid. However, during the connection setup (the first time a connection is checked out from the pool), our DB2 server is getting a lot of authentication errors as the connection attempts to hit every table on the host, not just the databases and libraries specified in our DSN.
Things I tried that work without causing any authentication errors:
Since pool::dbGetQuery(poolObject,SQLQuery) causes the error on the first time it is run, I tested manually using poolCheckout() then pool::dbGetQuery(). The authentication errors only happened on the poolCheckout() step in that process.
I am not familiar enough with the methods part of packages, so I am having trouble digging any further than isolating the issue to poolCheckout(). I would like to know how poolCheckout() sets up the connection the first time, so I can see if there is a way to prevent it from checking authentication on every single table on the DB2 server.
Thanks in advance for any help!
The text was updated successfully, but these errors were encountered: