Developers

"Overriding" TargetedMessage for ActionFulfillment crashes mobile app

Comments

7 comments

  • Avatar
    Miguel Estrada

    Thanks for the feedback Vitalijus, the team is currently investigating this.

  • Avatar
    Zach Stair

    @Vitalijus what kind of messages is your app sending/how frequent are they? Is the app invoked from a slashCommand or from a focused message (the purple underline)?

  • Avatar
    Vitalijus Rudzinskas

    I am using mostly what this this app is using:
    https://github.com/watsonwork/watsonwork-brewerydb-java

    It has CreateTargetedMessage functionality:
    https://github.com/watsonwork/watsonwork-brewerydb-java/blob/master/src/main/java/com/ibm/watsonwork/service/impl/DefaultGraphQLService.java


    What I was doing is creating an app which does something that takes time, but the app has like 10 seconds or so to respond to a button click event on desktop app or in browser, so I was trying to get around it with threading and stuff.

    Then I noticed by accident that I can respond with several targeted messages to a button click or some event and they will be displayed in the order they arrive. So if someone clicks a button - I can send one targetedMassage on main thread saying "Loading.", create another thread, do some serious operation and send another targetedMessage and it doesn't matter when the second thread finishes, the UI is not waiting for targetedMessage response anymore, cause it got the first message and displayed it. The user sees "Loading..." and waits for whatever happened next.

    And it's great, seems to be working everywhere.

    But then I had an idea of responding with targetedMessages to user as the app is doing things:
    "Loading...", "Connecting...", "Searching...."

    The idea being that this helps user, providing feedback on what is going on and if something goes wrong - the last message user saw is the stage where it crashed. This could help troubleshooting issues further, like: "I can see it shows a message saying 'connecting to database' but nothing happens after." And it shows us imediately how long do the stages take as well.

    When I tried to do that, as in: sent more than 2 targetedMessages in few seconds interval or even part-second intervals, it worked on desktop client and in browser but crashed the mobile app.

    Not entirely sure, but I think it was /command initiating the event. Didn't try it since last week. but we checked several times just to see it happening, after action is initialized, it looks like it is about to display something in the lower screen AF area and then app crashes and there is an option to send logs.

    So I just commented out all other messages I was sending except initial "Loading..." and the actual targetedMessage with information retrieved from database. Two messages work no problem.

    Hope this helps you.

  • Avatar
    Gary Silvers

    @Vitalijus we're investigating from your above info, but if you recreate it please send the logs when prompted.  It will provide more detail.  Thanks. 

  • Avatar
    Vitalijus Rudzinskas

    Hi Gary,

    I have created a test method that creates split second overriding messages that I send to the workspace:

    ```

    private void targetedMessageCrash(WebhookEvent webhookEvent)
    {
    for (int i=0;i<20;i++)
    {
    Thread t = new Thread(new Runnable()
    {
    public void run()
    {
    createTargetedMessage(webhookEvent, "", "*AAAAAAAA*" , null);

    try {
    Thread.sleep(500);
    } catch (InterruptedException e) {
    e.printStackTrace();
    }

    createTargetedMessage(webhookEvent, "", "*BBBBBBBB*" , null);

    try {
    Thread.sleep(500);
    } catch (InterruptedException e) {
    e.printStackTrace();
    }

    createTargetedMessage(webhookEvent, "", "*CCCCCCC*" , null);
    }
    });
    t.start();

    try {
    Thread.sleep(800);
    } catch (InterruptedException e) {
    e.printStackTrace();
    }
    }
    }


    ```
    This was initiated with /command. On a desktop app it displayed a quickly changing Action Fullfilment area of the app as the targetedMessages were racing for Watson workspace, quickly changing the text in the message from AAAAAAAA to BBBBBBBB, to CCCCCCCC.

    On a mobile phone it does the same approximately 50% of the time. The other 50% of time it made mobile app crash.

    We used /command to start above method 4 times and it crashed twice.

    I asked the person helping testing this to send the logs to Watson again. I have the zip file with logs here as well, but I can only attach images to messages here.

  • Avatar
    Zach Stair (Edited )

    So i managed to reproduce the issue, it seems to be related to the end-user closing the AF dialog.

    I have an app that is triggered via annotated message (the purple underline), and sends 80 messages in 12 seconds (the rate seems unimportant). If i leave the AF dialog open after i initiate the first action the app will always run to completion, but if i close the dialog (either with the X or just tapping out of the dialog) workspace crashes when the next message arrives.

    I haven't tried an app initiated from a slash command but it seems likely that the problem is the same.

    This seems like enough to go on, thanks @Vitalijus for being responsive!

  • Avatar
    Vitalijus Rudzinskas

    Hi, Zach

    The person who helped me testing swears he wasn't closing the dialog, but then again, I don't have a smartphone and I don't really know how the "tapping out of the dialog" works on that phone. But if you found something that crashes the app and is related to the AF dialog, it is most likely it, so best of luck fixing it, glad to help.

Please sign in to leave a comment.