{"action":"created","issue":{"url":"https://api.github.com/repos/googleapis/nodejs-pubsub/issues/124","repository_url":"https://api.github.com/repos/googleapis/nodejs-pubsub","labels_url":"https://api.github.com/repos/googleapis/nodejs-pubsub/issues/124/labels{/name}","comments_url":"https://api.github.com/repos/googleapis/nodejs-pubsub/issues/124/comments","events_url":"https://api.github.com/repos/googleapis/nodejs-pubsub/issues/124/events","html_url":"https://github.com/googleapis/nodejs-pubsub/issues/124","id":319369012,"node_id":"MDU6SXNzdWUzMTkzNjkwMTI=","number":124,"title":"modifyAckDeadline is duplicating messages","user":{"login":"JamesTheTerry","id":9438471,"node_id":"MDQ6VXNlcjk0Mzg0NzE=","avatar_url":"https://avatars3.githubusercontent.com/u/9438471?v=4","gravatar_id":"","url":"https://api.github.com/users/JamesTheTerry","html_url":"https://github.com/JamesTheTerry","followers_url":"https://api.github.com/users/JamesTheTerry/followers","following_url":"https://api.github.com/users/JamesTheTerry/following{/other_user}","gists_url":"https://api.github.com/users/JamesTheTerry/gists{/gist_id}","starred_url":"https://api.github.com/users/JamesTheTerry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JamesTheTerry/subscriptions","organizations_url":"https://api.github.com/users/JamesTheTerry/orgs","repos_url":"https://api.github.com/users/JamesTheTerry/repos","events_url":"https://api.github.com/users/JamesTheTerry/events{/privacy}","received_events_url":"https://api.github.com/users/JamesTheTerry/received_events","type":"User","site_admin":false},"labels":[{"id":958354328,"node_id":"MDU6TGFiZWw5NTgzNTQzMjg=","url":"https://api.github.com/repos/googleapis/nodejs-pubsub/labels/:rotating_light:","name":":rotating_light:","color":"FFFFFF","default":false},{"id":776935486,"node_id":"MDU6TGFiZWw3NzY5MzU0ODY=","url":"https://api.github.com/repos/googleapis/nodejs-pubsub/labels/priority:%20p2","name":"priority: p2","color":"fef2c0","default":false},{"id":784900901,"node_id":"MDU6TGFiZWw3ODQ5MDA5MDE=","url":"https://api.github.com/repos/googleapis/nodejs-pubsub/labels/type:%20question","name":"type: question","color":"c5def5","default":false}],"state":"open","locked":false,"assignee":{"login":"stephenplusplus","id":723048,"node_id":"MDQ6VXNlcjcyMzA0OA==","avatar_url":"https://avatars0.githubusercontent.com/u/723048?v=4","gravatar_id":"","url":"https://api.github.com/users/stephenplusplus","html_url":"https://github.com/stephenplusplus","followers_url":"https://api.github.com/users/stephenplusplus/followers","following_url":"https://api.github.com/users/stephenplusplus/following{/other_user}","gists_url":"https://api.github.com/users/stephenplusplus/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenplusplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenplusplus/subscriptions","organizations_url":"https://api.github.com/users/stephenplusplus/orgs","repos_url":"https://api.github.com/users/stephenplusplus/repos","events_url":"https://api.github.com/users/stephenplusplus/events{/privacy}","received_events_url":"https://api.github.com/users/stephenplusplus/received_events","type":"User","site_admin":false},"assignees":[{"login":"stephenplusplus","id":723048,"node_id":"MDQ6VXNlcjcyMzA0OA==","avatar_url":"https://avatars0.githubusercontent.com/u/723048?v=4","gravatar_id":"","url":"https://api.github.com/users/stephenplusplus","html_url":"https://github.com/stephenplusplus","followers_url":"https://api.github.com/users/stephenplusplus/followers","following_url":"https://api.github.com/users/stephenplusplus/following{/other_user}","gists_url":"https://api.github.com/users/stephenplusplus/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenplusplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenplusplus/subscriptions","organizations_url":"https://api.github.com/users/stephenplusplus/orgs","repos_url":"https://api.github.com/users/stephenplusplus/repos","events_url":"https://api.github.com/users/stephenplusplus/events{/privacy}","received_events_url":"https://api.github.com/users/stephenplusplus/received_events","type":"User","site_admin":false}],"milestone":null,"comments":7,"created_at":"2018-05-02T00:06:24Z","updated_at":"2018-12-16T07:40:16Z","closed_at":null,"author_association":"NONE","body":"#### Environment details\r\n\r\n  - OS: macOS 10.13.4 (High Sierra)\r\n  - Node.js version: 9.11.1\r\n  - npm version: 5.6.0\r\n  - `@google-cloud/pubsub` version: 0.18.0\r\n\r\n#### Steps to reproduce\r\n\r\n  1. Create a subscriber and topic\r\n  2. Send a message to the topic\r\n  3. Use v1's pull method\r\n  4. modifyAckDeadline of a single message\r\n  5. ack said message a couple seconds later\r\n\r\nI'm using Pub/Sub for processes that normally take a couple minutes, but can sometimes extend to 30+ mins. Here's a second by second look at what my little test setup does.\r\n\r\n0:00 - pulldown 1 message from subscription with 20 second deadline (or 600 seconds, same result)\r\n0:05 - modifyAckDeadline by 20 seconds\r\n0:15 - ack message; then pull down the same message from the queue\r\n\r\nI decided to try this with two instances pulling down messages. After sending one message, as soon as I would modifyAckDeadline on the instance that got the message, the other instance would pull down the message and start the same process.\r\n\r\nEventually, an ack finally sticks and the message goes away.\r\n\r\nSo it seems that modifyAckDeadline is creating a duplicate message."},"comment":{"url":"https://api.github.com/repos/googleapis/nodejs-pubsub/issues/comments/447623724","html_url":"https://github.com/googleapis/nodejs-pubsub/issues/124#issuecomment-447623724","issue_url":"https://api.github.com/repos/googleapis/nodejs-pubsub/issues/124","id":447623724,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NzYyMzcyNA==","user":{"login":"TraxRetail","id":18303381,"node_id":"MDQ6VXNlcjE4MzAzMzgx","avatar_url":"https://avatars2.githubusercontent.com/u/18303381?v=4","gravatar_id":"","url":"https://api.github.com/users/TraxRetail","html_url":"https://github.com/TraxRetail","followers_url":"https://api.github.com/users/TraxRetail/followers","following_url":"https://api.github.com/users/TraxRetail/following{/other_user}","gists_url":"https://api.github.com/users/TraxRetail/gists{/gist_id}","starred_url":"https://api.github.com/users/TraxRetail/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TraxRetail/subscriptions","organizations_url":"https://api.github.com/users/TraxRetail/orgs","repos_url":"https://api.github.com/users/TraxRetail/repos","events_url":"https://api.github.com/users/TraxRetail/events{/privacy}","received_events_url":"https://api.github.com/users/TraxRetail/received_events","type":"User","site_admin":false},"created_at":"2018-12-16T07:40:16Z","updated_at":"2018-12-16T07:40:16Z","author_association":"NONE","body":"I can confirm the issue: @google-cloud/pubsub 0.22.2 (consitst to a few lower version)\r\nnodejs 8.12.0\r\nnpm 6.5.0\r\nlinux mint 17.3\r\nI'm having the same issue with retrieving message before the lock is over, this is out test in nodejs:\r\n```\r\nconst cp = CloudProvider({type: GCP, env: 'INT'});\r\n            const rand = Math.random().toString(16);\r\n            await cp.queue.sendMessage(GCP_TOPIC_QUEUE, {test: rand});\r\n\r\n            const messages = await cp.queue.receiveMessage(GCP_QUEUE, {maxMessages: 10, waitTimeout: 2});\r\n            const message = messages.find(m => m.data.test === rand);\r\n\r\n            // Retrieving the message\r\n            assert.ok(message);\r\n\r\n            await cp.queue.extendMessageLock(GCP_QUEUE, message, {lockTimeout: 400});\r\n            await delay(360000);\r\n            const messages2 = await cp.queue.receiveMessage(GCP_QUEUE, {\r\n                maxMessages: 10,\r\n                waitTimeout: 2\r\n            });\r\n            const message2 = messages2.find(m => m.data.test === rand);\r\n\r\n            // Message should not be not be here, but is retrieved (it usually don't work but sometimes it\r\n            // does)\r\n            assert.ok(!message2);\r\n            // wait for the lock to be done\r\n            await delay(50000);\r\n\r\n            const messages3 = await cp.queue.receiveMessage(GCP_QUEUE, {maxMessages: 10, waitTimeout: 2});\r\n            const message3 = messages3.find(m => m.data.test === rand);\r\n\r\n            // Message should be here because `extendMessageLock` is over\r\n            assert.ok(message3);\r\n```\r\nextendMessageLock function\r\n```\r\nasync function extendMessageLock(queue, message, options = {}) {\r\n        const client = new pubSubHelper.v1.SubscriberClient({});\r\n        const subscription = client.subscriptionPath(GCP_PROJECT_ID, queue);\r\n        const ackDeadlineSeconds = isFinite(options.lockTimeout) ? options.lockTimeout : MESSAGE_LOCK_TIMEOUT;\r\n        const ids = messagesToIdArray(message);\r\n\r\n        return await client.modifyAckDeadline({subscription, ackIds: ids, ackDeadlineSeconds});\r\n    }\r\n```"}}
{"actor":{"display_login":"TraxRetail"}}