This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using Quest Commandlets in onPostGet Function (Looping & Crashing ActiveRoles Service)

I implemented a new script to our system yesterday that uses onPostGet to retrieve information and show information on a form after it loads. I have traced it down to running QAD commandlets in the onPostGet function. This leads to errors like:

Recursion is too deep; nested policy execution limit has been exceeded.

I've inserted an out-file inside to export the results of the QAD command, it seems to be running the command just fine but it's constantly running the onPostGet function over and over and over again, leaking RAM until the service crashes. If I delete the text file, it immediately comes back indicating a loop issue.

What I'm trying to do is to get group information, which I modified to use a $Request.AddRequestedAttribute in onPreGet and call that in onPostGet instead of the QAD commandlet, which fixed the looping but I need to also look up membership.

I've tried to use the $Request.AddRequestAttribute("Members") and call $Request.Get("Members") but that does not return a value. Calling Get-QADGroupMember causes the loop again.

  • onPostGet() is very intense handle to be called on any browse call (frequency cannot be controlled and depends on how client is coded) => So the function is called very often in the same session.
    Other possibility: error is suppressed and custom script code falls in loop.
    Recommendation: write clean code, check/catch errors explicitly, put condition (IF objectClass –eq “user”).
    Another recommendation: better not use such an expensive handle
  • The onPostGet and onGetEffectivePolicy are tricky beasts to work with. You need to get into implement code to manage "state" in order to prevent looping situations like you are describing.

    Perhaps you can tell us a bit more about what you are trying to do and we can see if we can suggest a "safer" approach.