Possible bug with WHILE and ASP.NET

Wappler Version : 5.8.2
Operating System : Windows Server 2019
Server Model: ASP.NET

Expected behavior

WHILE should exit when API action data results COUNT is zero.

Actual behavior

Endless looping

How to reproduce

Schema when records found

When no records are returned

I had a fellow community member check this for me and the WHILE statement did exit successfully, however, they created the SA on a NodeJS server modal whereas I am using ASP.NET.

The only way I can get the WHILE to exit is to set Max Iterations otherwise it performs an endless loop.

Any help would be grateful.
Thanks, Ray.

Show screenshots of all of your Set Value runwhile, most likely the issue is the lack of usage of global name. I suggest the global name to be different than the standard name, and the while loop should check this global name variable (I’m speaking from experience, I also opened a bug report about this on NodeJS, which was deemed invalid)

Hi Apple,

First set;

Second set;

I’ll try changing the global name.

Making that change made no difference.

Set the Max Iterations on the while to prevent infinite loops. Does the counter update correctly, perhaps it is always getting page 1 since counter is set to 0 and then counter + 1 is 1, when you do not update a global variable as with the runwhile it will always create a new local variable base on the counter from the parent scope.

Hi Patrick,

I have made the following changes.
I set the counter to one at the beginning and only increase it if the count of records is greater than zero.
I have also ensured that I am updating the global variable.

As a test, I provided a groupID, which I know has no records and set the Max Iterations to five.
image
When I do this, the infinite loops stop, and you can see that I have triggered the stop_runwhile and conditionresult = False.

So, with that in mind, you would think that if I remove the Max Iterations of five, I would still hit the triggers, but instead, I get infinite loops.

Ray

Hi Patrick,

Just wondering if you have any other suggestions to try and tie down why it’s infinite looping?

I can privately share the SA JSON if required.

Thanks,
Ray

Could you test if this update solves the infinite loop

DMXzone.ServerConnect.zip (56.7 KB)

1 Like

Hi Patrick,

A little bit of progress with that update.

With Max iterations empty, now it triggers the breakout of the WHILE statement when no devices found on the first call, however, If there are any devices found, I still get stuck in the loop.

image

Providing a known empty group.

Returns a condition result Fales and breaks out of the WHILE statement.

If I change it to a group with devices, say 545, it gets stuck in the loop. I can get it to breakout of the loop by putting back in Max iterations of say 5.

Thanks,
Ray

I think that is the counter, you always getting page 1 in each loop.

2 Likes

Hi Patrick,

The update file you provided has fixed the infinite loop once I corrected the counter issue.

To validate the updated files (DMXzone.ServerConnect), I put the original ones back and again it infinite looped. I again put the updated files back on the server, and the WHILE statement correctly breaks out.

Will you be including the fix in the next update?

Thanks for all your help,
Ray

1 Like

Fix will be included in the next Wappler Beta, if you want to stay on the current Stable version of Wappler you can use the file I’ve posted until you upgrade to Wappler 6.

It is possible that we maybe will make the update available as an extension update for the stable Wappler.

1 Like

Fixed in Wappler 6 beta 16

1 Like

This topic was automatically closed after 45 hours. New replies are no longer allowed.