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

Infrequent printing concurrency bug #133

Open
1 of 3 tasks
dimitris-m opened this issue Mar 7, 2025 · 0 comments
Open
1 of 3 tasks

Infrequent printing concurrency bug #133

dimitris-m opened this issue Mar 7, 2025 · 0 comments
Labels
bug Something isn't working ocaml-5 related to ocaml 5, domains, etc

Comments

@dimitris-m
Copy link
Collaborator

dimitris-m commented Mar 7, 2025

Describe the bug

Printing is not thread-safe. Relevant once #123 is merged.

To Reproduce

# run this command in a loop until error with some rule, in the opengrep repo: 
#
# opengrep-cli --experimental --timeout 5 --max-memory 5000 -j 8 -c <some-rule>.yaml  src/ libs/ 

$ n=0; while time opengrep-cli scan --experimental --timeout 5 --max-memory 5000 -j 8 -c <some-rule>.yaml src/ libs/ 2> >(tee /dev/stderr | grep -q "ERROR" && exit 1); do ((n++)); done; echo "failed after $((n+1)) attempts"

[01.62][ERROR]: Error: exception Invalid_argument: String.sub / Bytes.sub
Raised at Stdlib.invalid_arg in file "stdlib.ml", line 30, characters 20-45
Called from Stdlib__String.sub in file "string.ml" (inlined), line 43, characters 2-23
Called from Str.string_after in file "str.ml" (inlined), line 24, characters 23-59
Called from Matches_report.cut in file "src/osemgrep/reporting/Matches_report.ml", line 176, characters 4-27
Called from Matches_report.pp_finding.(fun) in file "src/osemgrep/reporting/Matches_report.ml", line 244, characters 25-55
Called from Stdlib__List.fold_left in file "list.ml", line 123, characters 24-34
Called from Matches_report.pp_finding in file "src/osemgrep/reporting/Matches_report.ml", lines 198-250, characters 4-28
Called from Matches_report.pp_text_outputs.print_one_match in file "src/osemgrep/reporting/Matches_report.ml", lines 379-381, characters 4-13
Called from List_.iter_with_view_into_neighbor_elements.loop in file "libs/commons/List_.ml", line 134, characters 8-28
Called from Stdlib__List.iter in file "list.ml", line 112, characters 12-15
Called from Output.output_result in file "src/osemgrep/reporting/Output.ml", line 253, characters 2-71
Called from Scan_subcommand.check_targets_with_rules in file "src/osemgrep/cli_scan/Scan_subcommand.ml", lines 660-663, characters 12-41
Called from Scan_subcommand.run_scan_conf in file "src/osemgrep/cli_scan/Scan_subcommand.ml", lines 805-813, characters 8-61
Called from CLI.dispatch_subcommand in file "src/osemgrep/cli/CLI.ml", line 196, characters 20-57
Called from CLI.safe_run in file "src/osemgrep/cli/CLI.ml", line 228, characters 8-12

opengrep-cli --experimental --timeout 5 --max-memory 5000 -j 8 -c ... src/ libs/  5.03s user 1.28s system 382% cpu 1.650 total
failed after 5101 attempts

What is the priority of the bug to you?

  • P0: blocking your adoption of Opengrep or workflow
  • P1: important to fix or quite annoying
  • P2: regular bug that should get fixed
@dimitris-m dimitris-m added bug Something isn't working ocaml-5 related to ocaml 5, domains, etc labels Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ocaml-5 related to ocaml 5, domains, etc
Projects
None yet
Development

No branches or pull requests

1 participant