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

Update chen to get memory and performance improvements #149

Merged
merged 12 commits into from
Jul 7, 2024

Conversation

prabhu
Copy link
Contributor

@prabhu prabhu commented Jul 3, 2024

@cerrussell Can you check this branch with atom-tools to ensure we don't lose any endpoints especially for python?

To install the atom command based on this branch.

git clone https://github.com/AppThreat/atom.git
cd atom
git checkout feature/chen-update-mem-perf
export GITHUB_TOKEN=PAT with read access
sbt clean stage scalafmt test createDistribution
cd wrapper/nodejs
bash build.sh && sudo npm install -g .

Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
@prabhu
Copy link
Contributor Author

prabhu commented Jul 3, 2024

@Hritik14 can you test #144 with this branch?

@cerrussell
Copy link
Member

@prabhu It does appear Python endpoints are lost with this. Javascript endpoints are also being lost but to a lesser extent.

@prabhu prabhu marked this pull request as draft July 4, 2024 08:25
@prabhu
Copy link
Contributor Author

prabhu commented Jul 4, 2024

@cerrussell, I manually reviewed the changes to chen and unable to pinpoint to anything in particular. Let's first review the setup and try using an existing release to get the baseline, which can be used for comparison.

@Hritik14
Copy link

Hritik14 commented Jul 4, 2024

I'm unable to rebuild, can you help ?

; git rev-parse HEAD
0a9eda776fa175299e3d24bae92230c1e0e24859
; cd wra
; ls
README.md  build.ps1  index.js      package-lock.json  php.ini       plugins  utils.mjs
astgen.js  build.sh   node_modules  package.json       phpastgen.js  target
; npm install .

up to date, audited 113 packages in 710ms

24 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
; find . -name "*atom*"
./node_modules/eslint/lib/rules/require-atomic-updates.js
; ls node_modules/.bin
acorn  eslint  js-yaml  node-which  parser  rimraf  tsc  tsserver
; sbt clean stage scalafmt test createDistribution                                                                                    [NORMAL]
cd wrapper/nodejs
bash build.sh && npm install  .
[warn] No sbt.version set in project/build.properties, base directory: /DIRECTORY/atom/wrapper/nodejs
[info] welcome to sbt 1.10.0 (Oracle Corporation Java 21.0.1)
[info] set current project to nodejs (in build file:/DIRECTORY/atom/wrapper/nodejs/)
[success] Total time: 0 s, completed 04-Jul-2024, 2:59:38 pm
[error] Not a valid command: stage (similar: last-grep, set, last)
[error] Not a valid project ID: stage
[error] Expected ':'
[error] Not a valid key: stage (similar: state, target, tags)
[error] stage
[error]      ^
cd: no such file or directory: wrapper/nodejs
Build the atom project using 'sbt createDistribution' before running this script
All settings correct for using Composer
Downloading...

Composer (version 2.7.7) successfully installed to: /DIRECTORY/atom/wrapper/nodejs/composer.phar
Use it: php composer.phar

./composer.json has been created
Running composer update nikic/php-parser
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking nikic/php-parser (v4.18.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating optimized autoload files
No security vulnerability advisories found.

up to date, audited 113 packages in 623ms

24 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

up to date, audited 113 packages in 599ms

24 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
;

; find . -name "*atom*"
./node_modules/eslint/lib/rules/require-atomic-updates.js

@prabhu
Copy link
Contributor Author

prabhu commented Jul 4, 2024

@Hritik14, I have updated the build instructions in the first comment. You can also use the below container image.

docker pull ghcr.io/appthreat/atom:feature-chen-update-mem-perf

@Hritik14
Copy link

Hritik14 commented Jul 4, 2024

Used the container image. Container VM has 8G memory.

Still OOM

bash-5.1# atom usages --extract-endpoints -l java .
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
        at java.base/java.lang.invoke.DirectMethodHandle.allocateInstance(DirectMethodHandle.java:501)
        at java.base/java.lang.invoke.DirectMethodHandle$Holder.newInvokeSpecial(DirectMethodHandle$Holder)
        at java.base/java.lang.invoke.Invokers$Holder.linkToTargetMethod(Invokers$Holder)
        at com.github.javaparser.ast.visitor.VoidVisitorAdapter.visit(VoidVisitorAdapter.java:442)
bash-5.1# find . -name "*.java" |  wc -l

123962

@prabhu
Copy link
Contributor Author

prabhu commented Jul 4, 2024

@Hritik14 can you repeat it with 16, 32 etc to find what is the max it needs?

Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
@prabhu prabhu marked this pull request as ready for review July 6, 2024 04:34
prabhu added 10 commits July 6, 2024 07:51
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
@prabhu
Copy link
Contributor Author

prabhu commented Jul 6, 2024

@cerrussell This is ready for retesting on windows. I added one test for Windows here.

@prabhu prabhu merged commit 590489d into main Jul 7, 2024
17 checks passed
@prabhu prabhu deleted the feature/chen-update-mem-perf branch July 7, 2024 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ready for qa
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants