Server crashing code - easy, short, without infinite loop :-)

Try creating an agent with below code and run it via web (e.g. from action button on a web form) so that it runs on server. You will be really surprised - your server will stop working.At first it looks only http process is down, but it will crash all the stuff. It is tested :slight_smile:

Sub Initialize

On Error Goto ummm	

Dim a As Variant



Redim a(0)

a = ":-)"

a = Arrayappend (a,getnull())



Exit Sub

ummm: Print(“So we are here…”)

Exit Sub

End Sub

Function getnull() As Variant

getnull = Null

End Function

Conclusion: never use unhandled function call as a parameter in arrayappend function.

Instead

a = Arrayappend (a,getnull())

rather use

b = getnull()

a = Arrayappend (a,b)

and it will run without any complaint…

Nice bug, isn’t it ?