JsSecuritySensorV2 hangs when scanning express route files

When using sonarcloud enterprise and sonar scanner cli v7.2.0.5079 my scan hangs for 6+ hours - and when running locally with verbose output I noticed it was stalling on express route files. I have an example of how one of these files look like in my project. Any ideas on how to resolve it? Currently I exclude the route files in the scan.

  • Github

  • Github Actions

  • /opt/hostedtoolcache/sonar-scanner-cli/7.2.0.5079/linux-x64/bin/sonar-scanner

  • Typescript/javascript

  • 15:42:27.423 INFO Sensor JsSecuritySensorV2 [jasmin]

    15:42:27.466 INFO 181 file(s) will be analysed by SonarJasmin.

    15:42:32.833 INFO Analysis progress: 9% (18/181 files)

    15:42:33.175 INFO Analysis progress: 19% (36/181 files)

    15:42:33.542 INFO Analysis progress: 29% (54/181 files)

    15:42:33.707 INFO Analysis progress: 39% (72/181 files)

    15:42:33.891 INFO Analysis progress: 49% (90/181 files)

    15:42:33.893 INFO Analysis progress: 59% (108/181 files)

  • Run scan on a express route file example

    import { Router } from ‘express’;
    import featureARoutes from ‘./feature-a.routes’;
    import featureBRoutes from ‘./feature-b.routes’;
    import featureCRoutes from ‘./feature-c.routes’;
    import healthRoutes from ‘./health.routes’;
    import featureDRoutes from ‘./feature-d.routes’;
    import featureERoutes from ‘./feature-e.routes’;
    import featureFRoutes from ‘./feature-f.routes’;
    import featureGRoutes from ‘./feature-g.routes’;
    
    const router = Router();
    
    router.use(‘/admin/feature-a/v1’, featureARoutes);
    router.use(‘/feature-b/v1’, featureBRoutes);
    router.use(‘/config/feature-c/v1’, featureCRoutes);
    router.use(‘/feature-d/v1’, featureDRoutes);
    router.use(‘/feature-e/v1’, featureERoutes);
    router.use(‘/feature-f/v1’, featureFRoutes);
    router.use(‘/feature-g/v1’, featureGRoutes);
    router.use(‘/monitor’, healthRoutes);
    
    export default router;
    
1 Like

Hello Albin, thanks for reaching out to us.

Could you check the available memory in the logs and try to increase it? Please look for Scanner max available memory and JVM max available memory (you can see a similar thread here for guidance).

Let us know if the problem persists.

1 Like