-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] CodeAnalyzerDFA is failing with timeout error: InternalExecutionError, Path evaluation timed out after 18000000 #1186
Comments
@abhishekkarns , please see our documentation on this matter. |
We tried everything suggested:
Running classes indivually then only few classes are failing that is either batch class or class having lots of logic and using helper classes. Helper classess scaning without any issue but when running Parent class getting InternalExecutionError. We are doing callout in helper class, is that causing any issue? Do we need to have any specific way to handle callouts or future methods for scanner? Please have a look and advise! |
What specific InternalExecutionError are you still getting when you run with just the parent class? |
Error: I believe it must be something related to callout and future call that is happening in helper class but helper class is scanner without any issue indivisually? |
Have you tried using a greater timeout than 30 minutes? It sounds like your code is pretty complicated, so it's possible that you might just need to give it more time. |
Increased timeout to 2.5 hours but still getting same error: Do we need to handle callout and future call in some specific manner for DFA scanner? |
My recollection is that you shouldn't have to do any kind of special handling for those. If you send me a sample of what the callouts/future calls being invoked are and how they're being invoked, I can do some testing. But my suspicion is that you might just need to increase the timeout. |
@jfeingold35 - Per suggestion, we tried running the scan with increased timeout. The scan even failed when timeout set as 5 hours, also tried a couple of times but it did not went through and still getting same error. Not sure if the scanner is getting stuck somewhere. Do you need the complete code to execute or you want to see the code and run scanner to debug it? Since the code has dependencies on custom objects, etc. it may not be possible to share executable code. However, I (and my team) can walk you through the code in a working session if we could connect over a meeting.
Alternatively, you may suggest a convenient time for us to connect. Join Zoom Meeting Meeting ID: 842 1929 9710 Thanks in advance! |
@jfeingold35 - We have shared an invite of the GIT code repository with you to further review. And, let me know if you need access to the sandbox org to test the code. Scan failing for these classes: |
@jfeingold35 - Hope you are doing well! |
@abhishekkarns , sorry, yesterday was Yom Kippur, so I spent all day in shul. |
@jfeingold35 Removed --pathexplimit -1 from command and ran for timeout 18000000, now getting OutOfMemory error, asking to run with a larger heap space, see error below: "4","3","D:\Muster\Muster Advocacy App\force-app\main\default\classes\MusterSettingsController.cls","20","31","MusterSettingsController","getMusterData","","","","LimitReached","Graph Engine reached the path expansion upper limit (7431). The So without --pathexplimit -1 getting OutOfMemory error and with --pathexplimit -1 getting timed out error even for 5 hours. Please advise. |
@abhishekkarns , okay. That does seem to support the notion that it's just a huge number of paths being expanded, and that sort of thing takes a while. You might just need to keep increasing the timeout until it passes.
This will force a null pointer exception, which halts further expansion of the path in question. If adding that before your future-call resolves this, that at least confirms that it's related. |
@jfeingold35 - We have already tried running the scan with 5 hours as timeout, and per suggestion, we added the code snippet before the future invocation but it still failed with below timeout error: "4","3","D:\Muster\Muster Advocacy App\force-app\main\default\classes\MusterSettingsController.cls","695","26","MusterSettingsController","syncBatchBasedOnDirection","","","","InternalExecutionError","Path evaluation timed out after 18000000 ms","https://forcedotcom.github.io/sfdx-scanner/en/v3.x/salesforce-graph-engine/rules/#ApexFlsViolationRule","InternalExecutionError","sfge" I truly appreciate your time in helping resolving the issue. Please suggest. |
@abhishekkarns , I'll start with the good news: a timeout error like what you're seeing is not a blocker for security review submission. You can always document it as a false positive and submit. The bad news is that if injecting the null pointer exception before the future-call didn't resolve the timeout, then it means the future call isn't what's causing the timeout. It really just sounds like the code is complex, and it's taking a while to scan. And in that case, there's really only a few things you can do.
|
We are back :) We refactored our code to reduce number of IF-ELSE and move them at lower levels and tried to identify what piece of code is causing the timeout error, but no success. What works independently, does not work when called by another class! Running command for path limit -1 and timeout 18000000, still not working and getting timeout error: InternalExecutionError, Path evaluation timed out after 18000000 In sfge log file seems it stuck at below lines of MusterCustomHandler class. From the log, looks like scanner is iterating on something and getting into infinite loop !! |
Hi, Today we did bit of more digging, looks like getting value from 0th index of a list is causing the problem - if(MainList != Null && MainList.size() > 0) { Instead of getting value from list's 0th index, changed the code to return object and set values as below: if(MainList != Null) { Scanning the class took around 5 hours but succeeded with no violations found! Does this makes sense? |
@acc-akar , I'm able to reproduce this with the code you provided, but I'm still working on determining a precise cause. In the meantime, if you've already discovered a refactor you can do that unblock the analysis, I would strongly encourage you to continue using that workaround for now. |
This issue has been linked to a new work item: W-15080470 |
Duplicate of #1294 |
Describe the bug
Getting error while scanning DFA:
Graph Engine reached the path expansion upper limit (8360). The analysis preemptively stopped running on this path to prevent an OutOfMemory error. Rerun Graph Engine and target this entry method with a larger heap space.
To Reproduce
Run command: sfdx scanner:run:dfa --sfgejvmargs "-Xmx20g" --format=csv --outfile=CodeAnalyzerDFA.csv --target="./" --projectdir="./" --category="Security"
**Current behavior
Getting InternalExecutionError with above error.
Expected behavior
Expecting scanning result to pass with 0 violation, but the scan terminates.
Additional context
Attaching log file for review.
sfge.log
"Urgency": Impacting business, need to submit package for security review.
The text was updated successfully, but these errors were encountered: