{"action":"created","issue":{"url":"https://api.github.com/repos/vert-x3/vertx-mongo-client/issues/143","repository_url":"https://api.github.com/repos/vert-x3/vertx-mongo-client","labels_url":"https://api.github.com/repos/vert-x3/vertx-mongo-client/issues/143/labels{/name}","comments_url":"https://api.github.com/repos/vert-x3/vertx-mongo-client/issues/143/comments","events_url":"https://api.github.com/repos/vert-x3/vertx-mongo-client/issues/143/events","html_url":"https://github.com/vert-x3/vertx-mongo-client/issues/143","id":311154792,"number":143,"title":"java.lang.IllegalStateException when using future completer","user":{"login":"leolux","id":5385814,"avatar_url":"https://avatars0.githubusercontent.com/u/5385814?v=4","gravatar_id":"","url":"https://api.github.com/users/leolux","html_url":"https://github.com/leolux","followers_url":"https://api.github.com/users/leolux/followers","following_url":"https://api.github.com/users/leolux/following{/other_user}","gists_url":"https://api.github.com/users/leolux/gists{/gist_id}","starred_url":"https://api.github.com/users/leolux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leolux/subscriptions","organizations_url":"https://api.github.com/users/leolux/orgs","repos_url":"https://api.github.com/users/leolux/repos","events_url":"https://api.github.com/users/leolux/events{/privacy}","received_events_url":"https://api.github.com/users/leolux/received_events","type":"User","site_admin":false},"labels":[{"id":153761854,"url":"https://api.github.com/repos/vert-x3/vertx-mongo-client/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/vert-x3/vertx-mongo-client/milestones/7","html_url":"https://github.com/vert-x3/vertx-mongo-client/milestone/7","labels_url":"https://api.github.com/repos/vert-x3/vertx-mongo-client/milestones/7/labels","id":2458452,"number":7,"title":"3.x.x","description":"","creator":{"login":"karianna","id":180840,"avatar_url":"https://avatars0.githubusercontent.com/u/180840?v=4","gravatar_id":"","url":"https://api.github.com/users/karianna","html_url":"https://github.com/karianna","followers_url":"https://api.github.com/users/karianna/followers","following_url":"https://api.github.com/users/karianna/following{/other_user}","gists_url":"https://api.github.com/users/karianna/gists{/gist_id}","starred_url":"https://api.github.com/users/karianna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karianna/subscriptions","organizations_url":"https://api.github.com/users/karianna/orgs","repos_url":"https://api.github.com/users/karianna/repos","events_url":"https://api.github.com/users/karianna/events{/privacy}","received_events_url":"https://api.github.com/users/karianna/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":0,"state":"open","created_at":"2017-04-15T10:11:10Z","updated_at":"2018-04-04T09:54:34Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2018-04-04T09:35:37Z","updated_at":"2018-04-06T13:33:35Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I cannot chain mongo operations with Futures because MongoClientImpl.java:758 somehow completes my future too early:\r\n\r\n```\r\nFuture updateFuture = new Future();\r\nexecuteUpdate(\"myCollection\", updateFuture.completer());\r\n\r\n \r\nprivate void executeUpdate(String collection, Handler<AsyncResult<Boolean>> completer) {\r\n //init query, update and options\r\n mongo.updateCollectionWithOptions(collection, query, update, options, res -> {\r\n        if (res.succeeded()) {         \r\n          completer.handle(Future.succeededFuture(true)); // <-- Here occurs the exception\r\n        } else {          \r\n          completer.handle(Future.failedFuture(res.cause()));\r\n        }\r\n      });\r\n}\r\n```\r\nThe exception looks like this:\r\n```\r\n [io.vertx.core.impl.ContextImpl] - Unhandled exception java.lang.IllegalStateException: Result is already complete: succeeded\r\n\tat io.vertx.core.impl.FutureImpl.complete(FutureImpl.java:84)\r\n\tat io.vertx.core.impl.FutureImpl.handle(FutureImpl.java:147)\r\n\tat io.vertx.core.impl.FutureImpl.handle(FutureImpl.java:18)\r\n\tat node.UpdateDocuments.lambda$executeUpdate$3(UpdateDocuments.java:10)\r\n\tat io.vertx.ext.mongo.impl.MongoClientImpl.lambda$null$11(MongoClientImpl.java:758)\r\n\tat io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:339)\r\n\tat io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)\r\n\tat io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)\r\n\tat io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)\r\n\tat io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)\r\n\tat io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\n```\r\n\r\nI use version 3.5.1"},"comment":{"url":"https://api.github.com/repos/vert-x3/vertx-mongo-client/issues/comments/379254584","html_url":"https://github.com/vert-x3/vertx-mongo-client/issues/143#issuecomment-379254584","issue_url":"https://api.github.com/repos/vert-x3/vertx-mongo-client/issues/143","id":379254584,"user":{"login":"tsegismont","id":1500598,"avatar_url":"https://avatars1.githubusercontent.com/u/1500598?v=4","gravatar_id":"","url":"https://api.github.com/users/tsegismont","html_url":"https://github.com/tsegismont","followers_url":"https://api.github.com/users/tsegismont/followers","following_url":"https://api.github.com/users/tsegismont/following{/other_user}","gists_url":"https://api.github.com/users/tsegismont/gists{/gist_id}","starred_url":"https://api.github.com/users/tsegismont/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsegismont/subscriptions","organizations_url":"https://api.github.com/users/tsegismont/orgs","repos_url":"https://api.github.com/users/tsegismont/repos","events_url":"https://api.github.com/users/tsegismont/events{/privacy}","received_events_url":"https://api.github.com/users/tsegismont/received_events","type":"User","site_admin":false},"created_at":"2018-04-06T13:33:34Z","updated_at":"2018-04-06T13:33:34Z","author_association":"CONTRIBUTOR","body":"@leolux I can see that. However I still fail to see how the Mongo Client is involved. In the snippets, the `updateFuture` is completed just once in the handler provided to the Mongo Client. I suspect it's completed elsewhere in your code. If I'm wrong, could you put together a small reproducer? Thanks"}}
{"actor":{"display_login":"tsegismont"}}