Skip to content

fix(profiling): Accept dots in the JVM profiling traces dir path - #6334

Open
runningcode wants to merge 2 commits into
mainfrom
no/fix-profiler-traces-dir-validation
Open

runningcode wants to merge 2 commits into
mainfrom
no/fix-profiler-traces-dir-validation

Conversation

@runningcode

@runningcode runningcode commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

📜 Description

So my agent discovered this because it was running the tests in a .workflow directory. Weird that we reject directories with certain names. If anyone knows the history on this, please comment!

Otherwise this fixes that and another issue in how JavaContinuousProfiler checks the profiling traces directory.

  • Certain characters like . no longer disable profiling. The profiler refused any traces directory whose path contained one of 26 characters, . among them. A cache dir like /home/app/.sentry or /opt/my.app/cache logged "Disabling profiling because traces directory path contains invalid character: .". async-profiler only treats two characters in the path specially:

    • , separates its arguments (start,jfr,...,file=<path>);
    • % starts a file-name pattern such as %p or %{ENV}.

    So those two are all it rejects now. The rest were never special: no shell runs the command, and async-profiler only splits key=value at the first =.

  • A rejected config now stays rejected. init() marked itself done before it checked the options and returned true on every later call. So only the first start was refused, and later starts went ahead with the same options, despite the "Disabling profiling" warning. It now remembers the result, as AndroidContinuousProfiler does. Sentry.init creates the traces directory before it builds the profiler, so nothing can make the options valid after the first start.

💡 Motivation and Context

Found while moving around our tests. Any checkout whose path has a dot, such as a worktree under .claude/worktrees/, fails because the fixture's relative tmp cache dir resolves to an absolute path.

  • resolves: JAVA-824

💚 How did you test it?

  • New tests:

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

None.

🤖 Generated with Claude Code

@sentry

sentry Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.62.0 (1) release

⚙️ sentry-android Build Distribution Settings

@linear-code

linear-code Bot commented Nov 3, 2026

Copy link
Copy Markdown

JAVA-824

runningcode and others added 2 commits November 3, 2026 15:40
JavaContinuousProfiler refused any traces directory whose path held one
of 26 characters, including ".", so a cache dir like /home/app/.sentry
or /opt/my.app logged "Disabling profiling". async-profiler only treats
"," (its argument separator) and "%" (file name patterns) specially, so
those are the only characters it still rejects.

The check also only stopped the first start: init() marked itself done
before validating and returned true from then on, so later starts went
ahead with the rejected options. It now remembers the result, as the
Android profiler does.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@runningcode
runningcode force-pushed the no/fix-profiler-traces-dir-validation branch from bc5ff49 to e60d94e Compare November 3, 2026 14:41
@runningcode
runningcode marked this pull request as ready for review November 3, 2026 14:44
@runningcode
runningcode requested review from a team and adinauer as code owners November 3, 2026 14:44
@runningcode
runningcode requested review from 0xadam-brown and markushi and removed request for a team November 3, 2026 14:44
@runningcode runningcode added the sanity-check PR needs a lightweight review for obvious issues label Nov 3, 2026

@markushi markushi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me! I'm holding off from approving this one straight away, so either @adinauer or @lbloder has a chance to chime in and provide historical context.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sanity-check PR needs a lightweight review for obvious issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants