Skip to content
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

[kotlin2cpg] Partly revert #4187 #4512

Merged
merged 1 commit into from
May 2, 2024
Merged

[kotlin2cpg] Partly revert #4187 #4512

merged 1 commit into from
May 2, 2024

Conversation

max-leuthaeuser
Copy link
Contributor

This PR partly reverts #4187. The change to CompilerAPI.makeEnvironment breaks sptests. We may want to revisit that change later as it was intented to improve performance.

With publishing this PR here locally sptests runs fine again.

This PR partly reverts #4187. The change to `CompilerAPI.makeEnvironment` breaks sptests.
We may want to revisit that change later as it was intented to improve performance.

With publishing this PR here locally sptests runs fine again.
@pandurangpatil
Copy link
Contributor

How do I reproduce the breaking issue you are referring to as sptest? Let me see how this can be fixed?

This consumes too much of memory and CPU for large repo. As it tries to build the type information cache for every path that is being passed as first parameter. The list we are passing is basically path to each and every child folder of the given project folder.

Which can be also achieved by passing only the root directory.

@max-leuthaeuser
Copy link
Contributor Author

max-leuthaeuser commented May 1, 2024

I don't know if you have access to codescience sptests but I guess you don't. On https://github.com/ShiftLeftSecurity/springboot-kotlin-webgoat the kotlin compiler completely errors out when only the root dir is given and that results in no type information at all.

@DavidBakerEffendi
Copy link
Collaborator

@max-leuthaeuser Do you have a deadline you could set for how long you're willing to wait for an alternative fix that achieves both goals? At least we have the webgoat for Kotlin to test against while @pandurangpatil looks into a fix

@max-leuthaeuser
Copy link
Contributor Author

Its for a running POC where the customer waits for an update. I don't know how patient this customer is, sorry. Maybe @gacevedo can say more.

@max-leuthaeuser
Copy link
Contributor Author

And from my point of view: the optimization in #4187 has never been released to the customers anyway. So we don't lose anything there. But we might lose type information now which may result in many lost findings as the broken sptests indicate. We should aim for high precision first and performance second.

Copy link
Collaborator

@DavidBakerEffendi DavidBakerEffendi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should aim for high precision first and performance second.

This is a good point, and the most important imo

@max-leuthaeuser max-leuthaeuser merged commit 9da2948 into master May 2, 2024
5 checks passed
@max-leuthaeuser max-leuthaeuser deleted the max/revert4187 branch May 2, 2024 06:27
@max-leuthaeuser
Copy link
Contributor Author

So I merged this to unblock the POC. A PR to get a fixed version of the performance optimization is very welcome nevertheless.

@pandurangpatil
Copy link
Contributor

@DavidBakerEffendi @max-leuthaeuser

I understand the importance of precision. At the same time in my humble opinion, we should have the failing use cases incorporated as unit tests. Otherwise, it becomes difficult to collaborate. This becomes very crucial while making any performance improvements. As the only way to make sure nothing is breaking is by running the unit test cases.

cc: @tuxology @fabsx00

@max-leuthaeuser
Copy link
Contributor Author

max-leuthaeuser commented May 2, 2024

@pandurangpatil
This is very true. We did not have a test for that in first place and relying on our internal sptests is not sufficient here as you guys do not have access. Also, these tests are only triggered once kotlin2cpg is updated internally (https://github.com/ShiftLeftSecurity/kotlin2cpg) which did not happen for 3 month (thats why this slipped through for so long completely unnoticed).

pandurangpatil added a commit to Privado-Inc/joern that referenced this pull request May 3, 2024
karan-batavia pushed a commit to Privado-Inc/joern that referenced this pull request Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants