[JAVA-2542] Issue with collection drop Created: 19/Jun/17 Updated: 27/Oct/23 Resolved: 19/Jul/17 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | pedrum jalali | Assignee: | Ross Lawley |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
ubuntu 16 lts |
||
| Description |
|
so I have a piece of code for dropping collections. It works on windows but not when its run in ubuntu.
I think it might be a bug Thanks |
| Comments |
| Comment by Ross Lawley [ 19/Jul/17 ] | |||||||
|
Thanks - glad you were able to figure out the cause. Ross | |||||||
| Comment by pedrum jalali [ 18/Jul/17 ] | |||||||
|
Just need to confirm that I was no longer able to reproduce the error. I believe the issue had something to do with the fact that I was creating a new mongo client for each thread in a multi-threaded application rather than passing a reference of the client to the different threads. You can mark it resolved now. | |||||||
| Comment by Ross Lawley [ 29/Jun/17 ] | |||||||
|
From the logs:
I can see there was a socket exception straight after the drop command on the same connection. It's reporting that the connection has been closed. Interesting, conn6 is also marked as closed and raises an exception. 1. Can you include debugging logging from the Java side? I'd be interested to see what is happening from the perspective of the drivers connection pool. All the best, Ross | |||||||
| Comment by pedrum jalali [ 28/Jun/17 ] | |||||||
|
I've uploaded the logs in gdrive. Before preparing the logs I deleted all previous logs. So what you are seeing are the logs for the following: 1- service mongodb restart Thanks in advance https://drive.google.com/file/d/0BwFUfWkiqC7VbHBscXk2OFRVNjQ/view?usp=sharing | |||||||
| Comment by Jeffrey Yemin [ 28/Jun/17 ] | |||||||
|
The documents in the list do not hold a reference to the collection, so clearing it will have no effect on the success or failure of the collection drop. If you can provide server logs we can proceed further with root cause analysis. | |||||||
| Comment by pedrum jalali [ 28/Jun/17 ] | |||||||
|
So I did some more testing. Apparently the issue was that I had previously done some query and converted to a list and I did not clear the list. The list was holding reference to the collection and hence the delete operation was not going through:
It might be good to explicitly note in the documents that the above collection needs to be freed with the command
| |||||||
| Comment by Jeffrey Yemin [ 22/Jun/17 ] | |||||||
|
In order to proceed I'd like to see the mongod logs for the drop command, for both the successful and unsuccessful case. It will look something like this:
You may have to boost the log level on the MongoDB server to ensure that the command is logged. Please include some context around the logging of the command in case there are any errors reported. | |||||||
| Comment by pedrum jalali [ 20/Jun/17 ] | |||||||
|
Hi, Thanks for the response. 1- Not it just silently fails to drop the collection 2- The java application is running on the same machine as the mongo server however as a separate application. I've tried the following setups: The first and last work. The second fails. I believe there is something wrong with the linux java driver. 3- Sure. The following is when both the application and mongodb are on the same machine on remote ubuntu: , os: { type: "Linux", name: "Linux", architecture: "amd64", version: "4.4.0-79-generic" }, platform: "Java/Oracle Corporation/1.8.0_131-8u131-b11-0ubuntu1.16.04.2-b11" } , os: { type: "Linux", name: "Linux", architecture: "amd64", version: "4.4.0-79-generic" }, platform: "Java/Oracle Corporation/1.8.0_131-8u131-b11-0ubuntu1.16.04.2-b11" } and the following is when mongodb is on remote ubuntu but java app is on local windows: , os: { type: "Windows", name: "Windows 10", architecture: "amd64", version: "10.0" }, platform: "Java/Oracle Corporation/1.8.0_131-b11" } , os: { type: "Windows", name: "Windows 10", architecture: "amd64", version: "10.0" }, platform: "Java/Oracle Corporation/1.8.0_131-b11" } and this is stuff that comes before. Its the same for both runs: , security: { authorization: "enabled" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true }}, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log", quiet: true } } | |||||||
| Comment by Jeffrey Yemin [ 19/Jun/17 ] | |||||||
To clarify, I have some questions:
|