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

Server[pid=XXXX] is already being debugged #2530

Open
felipewhitaker opened this issue Feb 11, 2025 · 4 comments
Open

Server[pid=XXXX] is already being debugged #2530

felipewhitaker opened this issue Feb 11, 2025 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@felipewhitaker
Copy link

felipewhitaker commented Feb 11, 2025

Environment data

OS and version: Windows 11
Python version (& distribution if applicable, e.g. Anaconda): Python 3.10.6 (conda-forge) [MSC v.1929 64 bit (AMD64)] on win32
Using VS Code or Visual Studio: VS Code, Azurite version 3.33

Behavior

Expected @blob_trigger to work, but received Server[pid=XXXX] is already being debugged error

Steps to reproduce:

  1. Follow AzFunc Quickstart
  2. Choose blob_trigger
  3. Create container (sample-workitems)
  4. Run
  5. (error message)

The related files are both in gist for easy reading, and in repository for reproduction.


{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "python",
    "4931ba_STORAGE": "UseDevelopmentStorage=true"
  }
}
# function_app.py
import azure.functions as func
import logging

app = func.FunctionApp()

@app.blob_trigger(arg_name="myblob", path="sample-workitems",
                               connection="4931ba_STORAGE") 
def blob_triggered(myblob: func.InputStream):
    logging.info(f"Python blob trigger function processed blob"
                f"Name: {myblob.name}"
                f"Blob Size: {myblob.length} bytes")
...
14 Client <-- Adapter:
{
    "seq": 5,
    "type": "response",
    "request_seq": 2,
    "success": false,
    "command": "attach",
    "message": "Server[pid=4768] is already being debugged."
}
...

Originally opened at microsoft/debugpy#1831

@felipewhitaker
Copy link
Author

felipewhitaker commented Feb 11, 2025

I was able to make it work! The problem was that I was waitting for blob to enter sample-workitems/temp, which does not work. My hypothesis is that temp/ can not be watched.

I have updated the repository as an example, so I invite developers to test the activities below and testing whether both are correctly triggered.

import azure.functions as func
import logging

app = func.FunctionApp()

@app.blob_trigger(arg_name="myblob", path="sample-workitems",
                               connection="4931ba_STORAGE") 
def blob_triggered(myblob: func.InputStream):
    # is triggered both for new blobs in `sample-workitems` and
    #   `sample-workitems/temp`
    logging.info(f"Python blob trigger function processed blob"
                f"Name: {myblob.name}"
                f"Blob Size: {myblob.length} bytes")

@app.blob_trigger(arg_name="myblob", path="sample-workitems/temp",
                               connection="4931ba_STORAGE") 
def temp_triggered(myblob: func.InputStream):
    # is not triggered when a blob enters `sample-workitems/temp`
    logging.info(f"Python blob trigger function processed blob"
                f"Name: {myblob.name}"
                f"Blob Size: {myblob.length} bytes")

@blueww blueww self-assigned this Feb 12, 2025
@blueww blueww added the question Further information is requested label Feb 12, 2025
@blueww
Copy link
Member

blueww commented Feb 12, 2025

Hi @felipewhitaker

Thanks for raising this issue!
However, I don't see what's the problem of Azurite in this issue.

If you need Azurite support, would you please Share the Azurite version, Azurite debug log, the expected Azurite behavior.

@felipewhitaker
Copy link
Author

Hi @blueww ,

I thought this would be the best place to raise this issue, but I sincerely do not know whether this is a problem with Azurite or some other component related to developing Azure Functions.

The problem is that the trigger does not work when watching temp/ folder, as the example above:

@app.blob_trigger(arg_name="myblob", path="sample-workitems",
                               connection="4931ba_STORAGE") 
def blob_triggered(myblob: func.InputStream):
    # is triggered both for new blobs in `sample-workitems` and
    #   `sample-workitems/temp`
    ...

@app.blob_trigger(arg_name="myblob", path="sample-workitems/temp",
                               connection="4931ba_STORAGE") 
def temp_triggered(myblob: func.InputStream):
    # is not triggered when a blob enters `sample-workitems/temp`
    ...

Azurite version: VS Code extension 3.33.0
Expected behavior: be correctly triggered

0 Starting Session:
{
    "name": "Attach to Python Functions",
    "type": "debugpy",
    "request": "attach",
    "connect": {
        "host": "localhost",
        "port": 9091
    },
    "logToFile": true,
    "preLaunchTask": "func: host start",
    "__configurationTarget": 6,
    "clientOS": "windows",
    "debugOptions": [
        "RedirectOutput",
        "ShowReturnValue"
    ],
    "justMyCode": true,
    "showReturnValue": true,
    "workspaceFolder": "\\azurite"
}
4 Client <-- Adapter:
{
    "seq": 1,
    "type": "event",
    "event": "output",
    "body": {
        "category": "telemetry",
        "output": "ptvsd",
        "data": {
            "packageVersion": "1.8.12"
        }
    }
}
5 Client <-- Adapter:
{
    "seq": 2,
    "type": "event",
    "event": "output",
    "body": {
        "category": "telemetry",
        "output": "debugpy",
        "data": {
            "packageVersion": "1.8.12"
        }
    }
}
10 Client --> Adapter:
{
    "command": "initialize",
    "arguments": {
        "clientID": "vscode",
        "clientName": "Visual Studio Code",
        "adapterID": "debugpy",
        "pathFormat": "path",
        "linesStartAt1": true,
        "columnsStartAt1": true,
        "supportsVariableType": true,
        "supportsVariablePaging": true,
        "supportsRunInTerminalRequest": true,
        "locale": "en",
        "supportsProgressReporting": true,
        "supportsInvalidatedEvent": true,
        "supportsMemoryReferences": true,
        "supportsArgsCanBeInterpretedByShell": true,
        "supportsMemoryEvent": true,
        "supportsStartDebuggingRequest": true,
        "supportsANSIStyling": true
    },
    "type": "request",
    "seq": 1
}
13 Client <-- Adapter:
{
    "seq": 3,
    "type": "response",
    "request_seq": 1,
    "success": true,
    "command": "initialize",
    "body": {
        "supportsCompletionsRequest": true,
        "supportsConditionalBreakpoints": true,
        "supportsConfigurationDoneRequest": true,
        "supportsDebuggerProperties": true,
        "supportsDelayedStackTraceLoading": true,
        "supportsEvaluateForHovers": true,
        "supportsExceptionInfoRequest": true,
        "supportsExceptionOptions": true,
        "supportsFunctionBreakpoints": true,
        "supportsHitConditionalBreakpoints": true,
        "supportsLogPoints": true,
        "supportsModulesRequest": true,
        "supportsSetExpression": true,
        "supportsSetVariable": true,
        "supportsValueFormattingOptions": true,
        "supportsTerminateRequest": true,
        "supportsGotoTargetsRequest": true,
        "supportsClipboardContext": true,
        "exceptionBreakpointFilters": [
            {
                "filter": "raised",
                "label": "Raised Exceptions",
                "default": false,
                "description": "Break whenever any exception is raised."
            },
            {
                "filter": "uncaught",
                "label": "Uncaught Exceptions",
                "default": true,
                "description": "Break when the process is exiting due to unhandled exception."
            },
            {
                "filter": "userUnhandled",
                "label": "User Uncaught Exceptions",
                "default": false,
                "description": "Break when exception escapes into library code."
            }
        ],
        "supportsStepInTargetsRequest": true
    }
}
14 Client --> Adapter:
{
    "command": "attach",
    "arguments": {
        "name": "Attach to Python Functions",
        "type": "debugpy",
        "request": "attach",
        "connect": {
            "host": "localhost",
            "port": 9091
        },
        "logToFile": true,
        "preLaunchTask": "func: host start",
        "__configurationTarget": 6,
        "clientOS": "windows",
        "debugOptions": [
            "RedirectOutput",
            "ShowReturnValue"
        ],
        "justMyCode": true,
        "showReturnValue": true,
        "workspaceFolder": "\\azurite",
        "__sessionId": "fbe2ed6e-1849-4096-a62f-53ac2a80437e"
    },
    "type": "request",
    "seq": 2
}
15 Client <-- Adapter:
{
    "seq": 4,
    "type": "event",
    "event": "debugpyWaitingForServer",
    "body": {
        "host": "127.0.0.1",
        "port": 51863
    }
}
165 Client <-- Adapter:
{
    "seq": 5,
    "type": "response",
    "request_seq": 2,
    "success": false,
    "command": "attach",
    "message": "Server[pid=24812] is already being debugged."
}
166 Client --> Adapter:
{
    "command": "disconnect",
    "arguments": {
        "restart": false
    },
    "type": "request",
    "seq": 3
}
168 Client <-- Adapter:
{
    "seq": 6,
    "type": "event",
    "event": "terminated"
}
168 Client <-- Adapter:
{
    "seq": 7,
    "type": "response",
    "request_seq": 3,
    "success": true,
    "command": "disconnect"
}
171 Stopping Session
174 Error:
{}

@blueww
Copy link
Member

blueww commented Feb 17, 2025

Not sure what's the blob_trigger called rest API.
So would you like to first get what's the rest API and server responds difference caused the "trigger does not work when watching temp/ folder", then we can see is this an Azurite issue.
You might can contact the team who owns blob_trigger first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants