Skip to content

ShowTypingMiddleware - Infinite loop of typing activity when Adapter on_error() method is called. #1980

Open
@Kevv-J

Description

@Kevv-J

Version

I am using the following packages

botbuilder-schema==4.13.0
botbuilder-core==4.13.0
botbuilder-dialogs==4.13.0

Describe the bug

ShowTypingMiddleware goes into an infinite loop of sending typing activity to user when on_error() method of the BotFrameworkAdapter is called. It doesn't stop till the application is restarted. This is easily reproduced in BotBuilder-Samples tested with BotFramework Emulator.

To Reproduce

Steps to reproduce the behavior:

  1. add ADAPTER.use(ShowTypingMiddleware(delay=0.5, period=1.0)) to app.py of 13, Core Bot Python Sample
  2. Write some code that takes calls the adapter's on_error() method i.e. print(ThisIsABug) in destination step in dialogs/booking_dialog.py
  3. Start the app and test the dialog from BotFramework Emulator.
  4. The app sends infinite typing activity to the emulator when the error is encountered in code.

Expected behavior

ShowTypingMiddleware should stop sending typing activity if on_error() method is called.

Screenshots

Screenshot from 2022-11-01 14-38-03

Additional context

NA

Activity

added
bugIndicates an unexpected problem or an unintended behavior.
needs-triageThe issue has just been created and it has not been reviewed by the team.
on Nov 1, 2022
added
customer-reportedIssue is created by anyone that is not a collaborator in the repository.
Bot ServicesRequired for internal Azure reporting. Do not delete. Do not change color.
on Nov 1, 2022
self-assigned this
on Nov 1, 2022
stevkan

stevkan commented on Nov 1, 2022

@stevkan
Collaborator

@Kevv-J,

ADAPTER.use(ShowTypingMiddleware(delay=0.5, period=1.0))

The delay and period properties take values expressed in milliseconds. So, for example, if you are wanting the delay to be half a second, then you would want to pass in delay=500. As you have it, the delay is set to half a millisecond and the period to one millisecond which likely is contributing to your issue.

Try adjusting those values, test again, and let me know if the issue persists.

added
customer-replied-toIndicates that the team has replied to the issue reported by the customer. Do not delete.
and removed
needs-triageThe issue has just been created and it has not been reviewed by the team.
on Nov 1, 2022
Kevv-J

Kevv-J commented on Nov 2, 2022

@Kevv-J
Author

Hi @stevkan,
Thanks for the quick reply. The documentation states that the delay and period properties take values in seconds as mentioned here, I had just used the default values of the function.

Just in case the documentation is incorrect I tried your suggestion with 500 as delay and 1000 as period and the typing activity was not sent even after 30 seconds of inactivity. tested by adding an await asyncio.sleep(30) inside the dialog.

Am I doing something wrong?

stevkan

stevkan commented on Nov 3, 2022

@stevkan
Collaborator

@Kevv-J,

Apologies for the confusion there. I had just looked over that bit of code but failed to notice it specifies seconds (vs milliseconds which is used in the other three SDKs). While it really shouldn't matter, it also shouldn't be necessary to name the properties when passing in the values to the middleware. Can you try ShowTypingMiddleware(0.5, 1.0) and see if that makes any difference.

In the meantime, I will work on repro'ing this and will get back to you with my results.

Kevv-J

Kevv-J commented on Nov 9, 2022

@Kevv-J
Author

Hi @stevkan

No luck with ShowTypingMiddleware(0.5, 1.0) I'm getting the same infinite typing activities bug when it goes into on_error().
Were you able to reproduce this on your end?

reopened this on Nov 9, 2022
anishprasad01

anishprasad01 commented on Nov 11, 2022

@anishprasad01

@Kevv-J,

We were able to reproduce this. Currently investigating further.

13 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Bot ServicesRequired for internal Azure reporting. Do not delete. Do not change color.ExemptFromDailyDRIReportUse this label to exclude the issue from the DRI report.bugIndicates an unexpected problem or an unintended behavior.customer-replied-toIndicates that the team has replied to the issue reported by the customer. Do not delete.customer-reportedIssue is created by anyone that is not a collaborator in the repository.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @axelsrz@stevkan@alexrecuenco@anishprasad01@Kevv-J

    Issue actions

      ShowTypingMiddleware - Infinite loop of typing activity when Adapter on_error() method is called. · Issue #1980 · microsoft/botbuilder-python