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

Worker endlessly runs on Invoke at a invalid function #1298

Open
Nanashi-lab opened this issue Feb 8, 2025 · 1 comment
Open

Worker endlessly runs on Invoke at a invalid function #1298

Nanashi-lab opened this issue Feb 8, 2025 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Nanashi-lab
Copy link

Nanashi-lab commented Feb 8, 2025

Description:

Invoking a worker with an invalid function name via the /invoke or /invoke-and-await endpoint causes the worker to enter an endless running state. Interrupting the worker also fails. This issue occurs when the function specified in the request does not exist or is malformed. On invoke-and-await it does return a valid 500 Internal Server Error.

Steps to Reproduce:

  1. Deploy a component and worker using the Golem backend server.
  2. Construct a POST request to the worker's /invoke or /invoke-and-await endpoint.
  3. In the request payload, specify a function parameter with an invalid or non-existent function name (For shopping-cart.wasm, invoke?function=golem:component/api.{checkout} is a valid function, Invoke at invoke?function=checkout or invoke?function=badinvoke:{badcheckout}). The params parameter is irrelevant to the bug.
  4. Send the POST request.

Expected Behavior:

The Golem backend should:

  • Return a 500 Internal Server Error indicating that the function name is invalid. (Which it does), and the worker should enter a failed state.
  • or Return a 400 Bad Request response, and let the worker be unaffected.
  • Maybe add failed invoke to the OPlog

Actual Behavior:

  • The worker enters an endless running state.
  • /invoke-and-await returns 500 Internal Server Error.
  • Attempting to interrupt the worker fails.

Environment:

  • Golem Backend Server Version: 1.1.6

Example (PowerShell for Reproduction):

Use your specific component and worker IDs, the following PowerShell snippet illustrates the general process of triggering the bug:

# Replace with your actual values 
$componentId = "<your_component_id>"
$workerId = "<your_worker_id>"
$url = "http://localhost:9881/v1/components/$componentId/workers/$workerId/invoke-and-await?function=invalid:function"
$jsonPayload = '{ "params": [] }'

try {
    $response = Invoke-RestMethod -Uri $url -Method Post -ContentType 'application/json' -Body $jsonPayload
    Write-Host "Response from server:"
    $response | ConvertTo-Json | Write-Host
} catch {
    Write-Host "Error occurred:"
    Write-Host $_.Exception.Message
}
@vigoo
Copy link
Contributor

vigoo commented Feb 8, 2025

Interesting, I think we have a specific executor test for this. Will take a look

@vigoo vigoo added the bug Something isn't working label Feb 8, 2025
@vigoo vigoo added this to the Golem 1.2 milestone Feb 8, 2025
@vigoo vigoo self-assigned this Feb 8, 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
Projects
None yet
Development

No branches or pull requests

2 participants