[BUG] sharedState from Scripting Tool is race-condition

Open
#2,429 1 comment 0 reactions 1 assignee View on GitHub

@NghiaTranUIT is already working on this.

Since Jul 29, 2025.

Assessment

This issue has not been assessed yet.

Description

✅ Done bug

Description

sharedState from Scripting Tool is race-condition

Steps to Reproduce

  1. Use * for Matching URL
  2. Use this script
async function onRequest(context, url, request) {
  sharedState.testCounter = sharedState.testCounter ?? 0;
  sharedState.testCounter++;
  console.log(`sharedState test counter ${new Date().toISOString()}:`, sharedState.testCounter);
  return request;
}

Current Behavior

sharedState test counter 2025-07-27T18:57:00.169Z: 1
sharedState test counter 2025-07-27T18:57:00.728Z: 2
sharedState test counter 2025-07-27T18:57:00.741Z: 3
sharedState test counter 2025-07-27T18:57:00.752Z: 4
sharedState test counter 2025-07-27T18:57:00.766Z: 5
sharedState test counter 2025-07-27T18:57:00.776Z: 6
sharedState test counter 2025-07-27T18:57:00.790Z: 7
sharedState test counter 2025-07-27T18:57:00.808Z: 8
sharedState test counter 2025-07-27T18:57:00.815Z: 9
sharedState test counter 2025-07-27T18:57:00.840Z: 10
sharedState test counter 2025-07-27T18:57:00.844Z: 11 👈
sharedState test counter 2025-07-27T18:57:00.846Z: 11 👈
sharedState test counter 2025-07-27T18:57:00.848Z: 12 👈
sharedState test counter 2025-07-27T18:57:00.848Z: 12 👈
sharedState test counter 2025-07-27T18:57:00.848Z: 12 👈
sharedState test counter 2025-07-27T18:57:00.849Z: 12 👈
sharedState test counter 2025-07-27T18:57:00.849Z: 13   👈
sharedState test counter 2025-07-27T18:57:00.850Z: 12 👈
sharedState test counter 2025-07-27T18:57:00.854Z: 12 👈
sharedState test counter 2025-07-27T18:57:00.866Z: 13   👈
sharedState test counter 2025-07-27T18:57:00.871Z: 14
sharedState test counter 2025-07-27T18:57:00.873Z: 15 👈
sharedState test counter 2025-07-27T18:57:00.873Z: 15 👈
sharedState test counter 2025-07-27T18:57:00.932Z: 16

Expected Behavior

  • Should not happen

Environment

  • App version: Proxyman 5.23.0
Dominant language
No language data
Stars
7k
Forks
237
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ProxymanApp/Proxyman

All issues in ProxymanApp/Proxyman

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.