Wappler Created Me a 465Mb Server Action!

@patrick, I think this one is for you…

I have a strange message being returned by a server action in the Network debug tab of Chrome:

data: "<br />↵<font size='1'><table class='xdebug-error xe-fatal-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'>↵<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 134217728 bytes) in Unknown on line <i>0</i></th></tr>↵</table></font>↵"

I have a structure of server actions calling each other via API calls in this hierarchy:

messages/send_message_template.php (called from a server connect)
    api/send_message_template.php
       api/send_message.php
          api/send_email_transactional.php
          api/send_sms.php

This error occurs when “send_message.php” is called through the API call from another server action.

I have a second problem in that when I edit the API Action Step in “send_message.php” that calls “api/send_email_transactional.php”, then Wappler freezes, consumes 50% of my laptop’s CPU and takes about 2 minutes to close. I also notice that as I move between the server actions in Wappler, Wappler is noticably slower to both open and save the server action “send_message.php”.

All the PHP code has been created in Wappler with no hand editing of the files.

What is the best way to go about finding a solution to this?

Many thanks,
Antony.

Do you have loops inside that structure? Could it be an infinite loop?

Yes @JonL, I was wondering that… but there are only 3 loops and they are all on a some_text.split(',') structure so shouldn’t go infinite…

… and since opening and closing “send_message.php” is slower in Wappler, I suspect there is something in the source php that is a little strange…

I am now getting a save error when trying to save the server action “send_message.php” in Wappler.

The RED message says “Invalid String Length”.

Presumably you were able to save the server action before, so whatever you last did has caused this error. I expect your only option is to cancel.

When creating a complicated server action, I would make copies of it as I go along, so if something goes wrong I can revert and try again. I would apply the same approach generally - to a block of PHP or any substantial changes to a section in a webpage. I expect you might do something similar.

If you’ve got this far with the current server action and it’s not working, you could retrace your steps, commenting out sections or duplicating the action and simplifying it, to isolate the issue. Again, I would apply this approach to any sort of development.

Sadly that approach is no longer possible @TomD, as when I disable what I need to disable, Wappler freezes!

Could you duplicate the action (without saving the last changes), and then removes parts of it for debugging?

Duplicating the action takes about 30 seconds to complete… there is clearly something in the action code that Wappler doesn’t like!

As long as you can duplicate it, you can remove sections and (slowly perhaps) isolate the issue.

A glance through the PHP might help too. I’ve sometimes come across strange code - eg where a condition is nested inside another condition (in a query). I thougth it was a bug - as I’d used query builder - but then I realised I probably pasted some code into a condition, adding to the code rather than replacing it. Looking at the action PHP code, it was obvious that the code was incorrect.

WOW! Just tried to send my design to github and got a file size error message.

Look at the size of my send_message.php file!

big

Wappler, how did you manage to create that?

@patrick, can I send you the file and you put it on a slimming programme for me?

1 Like

Too much pr0n. Now you know what happened!

1 Like

Size is not important… Show-off! :smiley:

5 Likes

Ya, you just go ahead and send that 400MB file to Patrick…actually better send it to all three of them. :innocent:

2 Likes

Kidding aside…what the heck is inside that file?

I’d question that size. I’d check in more than one source for the file size. What does your system say the file size is?

I would think there is an error somewhere.

God knows! I found it just before bed time so decided it best not to try to open such a pandora’s box before I go to sleep!

I don’t. Windows and git agree it is rather humungous.

Then I would rethink my plan. Loading that size of file on a cell phone data plan would be disastrous. I assume that is the file with over 200 steps in your action?

No, that one only has about 50 steps. The 200 step one works just fine now.

Well here it is…

After taxing my computer’s hardware to display nearly 5,000,000 lines of code, this is what lies at the heart of my mega server action…

It seems like Wappler has taken some of my nested repeats and gone a little wild whilst saving them… making Tuesday the most lines of code I will ever create in one day!