5G-MAG / rt-5gms-application-server

5G Media Streaming - Application Server
https://www.5g-mag.com/streaming
Other
4 stars 5 forks source link

Application Server crash on certificate upload #46

Closed devbbc closed 1 year ago

devbbc commented 1 year ago

When POSTing the certificate via M3, the Application Server seems to create / add the certificate successfully as it tries to send response with status 201. But it crashes when sending the response, with the following message. Same error happens when trying to update the certificate through the PUT method.

venv/bin/5gms-application-server -c local.conf
INFO:rt-5gms-as:Getting list of certificates...
INFO:rt-5gms-as:Getting list of content hosting configurations...
DEBUG:rt-5gms-as:Context.haveCertificate('d54a1fcc-d411-4e32-807b-2c60dbaeaf5f:testcert1') = False
INFO:rt-5gms-as:Adding certificate d54a1fcc-d411-4e32-807b-2c60dbaeaf5f:testcert1...
[2022-11-14 18:06:15 +0000] [348937] [ERROR] Error in ASGI Framework
Traceback (most recent call last):
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/hypercorn/asyncio/task_group.py", line 23, in _handle
    await app(scope, receive, send, sync_spawn, call_soon)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/hypercorn/app_wrappers.py", line 33, in __call__
    await self.app(scope, receive, send)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/fastapi/applications.py", line 270, in __call__
    await super().__call__(scope, receive, send)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/starlette/applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 75, in __call__
    raise exc
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 64, in __call__
    await self.app(scope, receive, sender)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/starlette/routing.py", line 680, in __call__
    await route.handle(scope, receive, send)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/starlette/routing.py", line 275, in handle
    await self.app(scope, receive, send)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/starlette/routing.py", line 65, in app
    response = await func(request)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/fastapi/routing.py", line 231, in app
    raw_response = await run_endpoint_function(
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/fastapi/routing.py", line 160, in run_endpoint_function
    return await dependant.call(**values)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/rt_5gms_as/openapi_5g/apis/default_api.py", line 75, in create_server_certificate
    await rt_5gms_as_svr_ifc.create_server_certificate(provisioningSessionId,certificateId,body, request=request)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/rt_5gms_as/server.py", line 90, in create_server_certificate
    raise NoProblemException(status_code=201, media_type='application/json', headers={'Location': request.url.path})
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/rt_5gms_as/exceptions.py", line 71, in __init__
    headers['Server'] = '5GMSd-AS/'+__pkg_version
NameError: name '_NoProblemException__pkg_version' is not defined
ERROR:hypercorn.error:Error in ASGI Framework
Traceback (most recent call last):
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/hypercorn/asyncio/task_group.py", line 23, in _handle
    await app(scope, receive, send, sync_spawn, call_soon)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/hypercorn/app_wrappers.py", line 33, in __call__
    await self.app(scope, receive, send)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/fastapi/applications.py", line 270, in __call__
    await super().__call__(scope, receive, send)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/starlette/applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 75, in __call__
    raise exc
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 64, in __call__
    await self.app(scope, receive, sender)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/starlette/routing.py", line 680, in __call__
    await route.handle(scope, receive, send)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/starlette/routing.py", line 275, in handle
    await self.app(scope, receive, send)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/starlette/routing.py", line 65, in app
    response = await func(request)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/fastapi/routing.py", line 231, in app
    raw_response = await run_endpoint_function(
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/fastapi/routing.py", line 160, in run_endpoint_function
    return await dependant.call(**values)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/rt_5gms_as/openapi_5g/apis/default_api.py", line 75, in create_server_certificate
    await rt_5gms_as_svr_ifc.create_server_certificate(provisioningSessionId,certificateId,body, request=request)
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/rt_5gms_as/server.py", line 90, in create_server_certificate
    raise NoProblemException(status_code=201, media_type='application/json', headers={'Location': request.url.path})
  File "/home/ubuntu/rt-5gms-application-server/venv/lib/python3.8/site-packages/rt_5gms_as/exceptions.py", line 71, in __init__
    headers['Server'] = '5GMSd-AS/'+__pkg_version
NameError: name '_NoProblemException__pkg_version' is not defined
davidjwbbc commented 1 year ago

@devbbc, that is an old version of the code from my fork. Can you please git pull the latest version and try again?

devbbc commented 1 year ago

Obtaining the latest version through git pull and building the Application Server solves the problem. The Application Server does not crash now and can handle certificate requests.

davidjwbbc commented 1 year ago

Ok, the issue was already fixed, closing this.