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

sendEmail hangs forever #25915

Closed
3 tasks
offbeatful opened this issue May 18, 2023 · 9 comments
Closed
3 tasks

sendEmail hangs forever #25915

offbeatful opened this issue May 18, 2023 · 9 comments
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. Communication - Email customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-author-feedback Workflow: More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue.

Comments

@offbeatful
Copy link

  • @azure/communication-email:
  • 1.0.0:
  • MacOS Arm64:
  • nodejs
    • v18.14.2:
  • typescript
    • 5.0.4:
  • Is the bug related to documentation in

Describe the bug
sendEmail hangs forever. Exact steps are unknown except the issues start occurring after sending 50+ emails.

To Reproduce
Steps to reproduce the behavior:
1.

Expected behavior
Method should return always.

Additional context

The suspect is LRO lib (@azure/core-lro 2.5.3) at dist/index.js:961

    poll(options = {}) {
        if (!this.pollOncePromise) {
            this.pollOncePromise = this.pollOnce(options);
            const clearPollOncePromise = () => {
                this.pollOncePromise = undefined;
            };
            this.pollOncePromise.then(clearPollOncePromise, clearPollOncePromise).catch(this.reject);
        }
        return this.pollOncePromise;
    }

It seems that if this.pollOnce return resolved promise, then clearPollOncePromise is executed immediately, leaving this.pollOncePromise as undefined. Changing the method to something like this, solves the problem.

    poll(options = {}) {
        var returnValue = this.pollOncePromise;
        if (!returnValue) {
            returnValue = this.pollOncePromise = this.pollOnce(options);
            const clearPollOncePromise = () => {
                this.pollOncePromise = undefined;
            };
            this.pollOncePromise.then(clearPollOncePromise, clearPollOncePromise).catch(this.reject);
        }
        return returnValue;
    }

Also not sure if clearPollOncePromise should be executed twice.

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels May 18, 2023
@jeremymeng
Copy link
Member

@deyaaeldeen for LRO discussion.

@xirzec xirzec added Communication - Email Client This issue points to a problem in the data-plane of the library. bug This issue requires a change to an existing behavior in the product in order to be resolved. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels May 18, 2023
@github-actions github-actions bot removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label May 18, 2023
@akania akania assigned kagbakpem and unassigned akania May 18, 2023
@MaryGao
Copy link
Member

MaryGao commented Jun 5, 2023

@offbeatful Thanks for reporting this! I am trying to reproduce this issue in my local, could you help with details:

  • I guess it happened when calling client.beginSend could you share your parameter with me?
  • Could you share more about what you observed on why the program is stuck?
  • Just double confirm that you tried your solution in you local and it works right?

@offbeatful
Copy link
Author

Yes, that is correct. I am basically replacing the code in node_modules in order to make code actually send emails and not hang.
I don’t do anything crazy. Just follow official guide - instantiate class and invoke method. I do this in a loop, for 100+ emails, awaiting each of these (I already asked to increase the quota, so I was able to send more than 30 per minute). For the first 30-50 emails everything seems working. And then, it starts returning faster and lat some time it stopped working - simply hangs.

@MaryGao MaryGao self-assigned this Jun 8, 2023
@MaryGao
Copy link
Member

MaryGao commented Jul 11, 2023

@offbeatful Could you try to repro the issue and then share the logs with the fix you mention?

import { setLogLevel } from "@azure/logger";

setLogLevel("verbose");

I tried this in my local and as you said everything seems working for the first 50 emails, but after that it stopped working and simply hangs. Then I debugged the code and found the server side has complained with 429 TooManyRequests error and with retry-after header so our program just hangs and waits the timeout to retry again. I tried the code you mentioned but it still hangs and I am not sure I met the same case with you.

image

@MaryGao MaryGao added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Jul 12, 2023
@github-actions
Copy link

Hi @offbeatful. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

@offbeatful
Copy link
Author

It may be a case, as I requested to increase the quota and haven’t experienced the issue before.

I will try sending 100 emails and report back soon.

@github-actions github-actions bot added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-author-feedback Workflow: More information is needed from author to address the issue. labels Jul 12, 2023
@MaryGao
Copy link
Member

MaryGao commented Jul 12, 2023

@offbeatful Thanks for the info! If this is the case for server-side 429 TooManyRequests I don't think any fix in client side would work. So please let us know if any client-side fix would stop hangs and share with us logs.

We may prefer to close this issue and do you have any concern?

@MaryGao MaryGao added needs-author-feedback Workflow: More information is needed from author to address the issue. and removed needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Jul 12, 2023
@github-actions
Copy link

Hi @offbeatful. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

@github-actions
Copy link

Hi @offbeatful, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

@github-actions github-actions bot added the no-recent-activity There has been no recent activity on this issue. label Jul 20, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 4, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Nov 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. Communication - Email customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-author-feedback Workflow: More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue.
Projects
None yet
Development

No branches or pull requests

6 participants