camaraproject / QualityOnDemand_PI2

Provider Implementation of QualityOnDemand by Orange
Apache License 2.0
0 stars 1 forks source link

Facing OutOfMemoryError: Java heap space when calling create session. #5

Open WillusDong opened 10 months ago

WillusDong commented 10 months ago

PoD PI2 is configured to run with wiremock provided in master branch, when create session request is made from swagger-ui, it fails and the application runs into memory issue - OutOfMemoryError: Java heap space.

Top output: top_camara-qod-0 9 0-runner

application.property

cat src/main/resources/application.properties 
# Swagger UI
quarkus.swagger-ui.enable=true
quarkus.swagger-ui.always-include=true

# Global Server configuration
# Be aware servlet.context-path is relative to http.root-path
quarkus.http.root-path=qod/v0
quarkus.http.port=8080
quarkus.application.name=camara-qod
quarkus.log.console.format=%d{HH:mm:ss} %-5p [%c{2.}] (%t) %s%e%n
camara.notifications.base-url=http://localhost:8080/qod/v0/notifications

# Log configuration
quarkus.log.level=FINEST

# Redis config
#quarkus.redis.hosts=redis://${REDIS_CLIENTUSERNAME}:${REDIS_CLIENTPASSWORD}@${REDIS_HOST}:${REDIS_PORT}
quarkus.redis.hosts=redis://192.168.1.43:6379
quarkus.rest-client."com.camara.scef.ScefClient".url=https://localhost:8888/http://localhost:8888/apigm
quarkus.oidc-client.token-path=https://localhost:8888/oauth/v3/token

quarkus.oidc-client.grant.type=client
quarkus.oidc-client.client-id=${CLIENT_ID}
quarkus.oidc-client.credentials.secret=${CLIENT_SECRET}
# Basic Authentication
quarkus.http.auth.basic=true
quarkus.security.users.embedded.enabled=true
quarkus.security.users.embedded.plain-text=true
## OrangeDevPortal
quarkus.security.users.embedded.users.OrangeDevPortal=password
quarkus.security.users.embedded.roles.OrangeDevPortal=OrangeDevPortal
## admin
quarkus.security.users.embedded.users.admin=password
quarkus.security.users.embedded.roles.admin=admin
## sessions and qosProfiles Access Configuration
quarkus.http.auth.policy.OrangeDevPortal-policy.roles-allowed=OrangeDevPortal,admin
quarkus.http.auth.permission.role-OrangeDevPortal.paths=sessions,sessions/*,qosProfiles,qosProfiles/*
quarkus.http.auth.permission.role-OrangeDevPortal.policy=OrangeDevPortal-policy

## admin Access Configuration
quarkus.http.auth.policy.admin-policy.roles-allowed=admin
quarkus.http.auth.permission.role-admin.paths=admin/profiles,admin/profiles/*
quarkus.http.auth.permission.role-admin.policy=admin-policy

Profile config:

redis-cli GET profiles | jq
{
  "vp251iMf1TJiFQq1jpzihd9E9K40.lHI89cTyIdtumWq2VB_cCM4KmUqYvUP8TJCzXab1PvqjaS-vIWwltxHsUjUN": {
    "flowId": 0,
    "qosProfile": {
      "name": "vp251iMf1TJiFQq1jpzihd9E9K40.lHI89cTyIdtumWq2VB_cCM4KmUqYvUP8TJCzXab1PvqjaS-vIWwltxHsUjUN",
      "description": "string",
      "status": "ACTIVE",
      "targetMinUpstreamRate": {
        "value": 1024,
        "unit": "bps"
      },
      "maxUpstreamRate": {
        "value": 1024,
        "unit": "bps"
      },
      "maxUpstreamBurstRate": {
        "value": 1024,
        "unit": "bps"
      },
      "targetMinDownstreamRate": {
        "value": 1024,
        "unit": "bps"
      },
      "maxDownstreamRate": {
        "value": 1024,
        "unit": "bps"
      },
      "maxDownstreamBurstRate": {
        "value": 1024,
        "unit": "bps"
      },
      "minDuration": {
        "value": 1,
        "unit": "Days"
      },
      "maxDuration": {
        "value": 1,
        "unit": "Days"
      },
      "priority": 100,
      "packetDelayBudget": {
        "value": 1,
        "unit": "Days"
      },
      "jitter": {
        "value": 1,
        "unit": "Days"
      },
      "packetErrorLossRate": 10
    }
  }
}

Request

curl -X 'POST' \
  'http://localhost:8080/qod/v0/sessions' \
  -H 'accept: application/json' \
  -H 'X-OAPI-Application-Id: appId' \
  -H 'Content-Type: application/json' \
  -d '{
  "duration": 86400,
  "device": {
    "phoneNumber": "12345678901",
    "networkAccessIdentifier": "example@ericsson.com",
    "ipv4Address": {
      "publicAddress": "10.175.188.24",
      "privateAddress": "4.186.12.7",
      "publicPort": 1234
    },
    "ipv6Address": {}
  },
  "applicationServer": {
    "ipv4Address": "10.175.188.23"
  },
  "devicePorts": {
    "ranges": [
      {
        "from": 0,
        "to": 65535
      }
    ],
    "ports": [
      1234
    ]
  },
  "applicationServerPorts": {
    "ranges": [
      {
        "from": 0,
        "to": 65535
      }
    ],
    "ports": [
      4321
    ]
  },
  "qosProfile": "vp251iMf1TJiFQq1jpzihd9E9K40.lHI89cTyIdtumWq2VB_cCM4KmUqYvUP8TJCzXab1PvqjaS-vIWwltxHsUjUN",
  "webhook": {
    "notificationUrl": "http://localhost:8080/qosChanged",
    "notificationAuthToken": "L2xvY2FsaG9zdDoxMDAxMi9Bc1NDUy9ub3RpZnk"
  }
}'

LOG log.txt

patrice-conil commented 10 months ago

Hi @WillusDong, This implementation supports only device designed by ipv4Address.publicAddress and single port.

Try something like this.

{
    "duration": 86400,
    "device": {
        "ipv4Address": {
            "publicAddress": "192.168.0.2"
        }
    },
    "applicationServer": {
        "ipv4Address": "192.168.0.1"
    },
    "devicePorts": {
        "ports": [
            5022
        ]
    },
    "applicationServerPorts": {
        "ports": [
            5010
        ]
    },
    "qosProfile": "vp251iMf1TJiFQq1jpzihd9E9K40.lHI89cTyIdtumWq2VB_cCM4KmUqYvUP8TJCzXab1PvqjaS-vIWwltxHsUjUN",
    "webhook": {
          "notificationUrl": "http://localhost:8080/qosChanged",
          "notificationAuthToken": "L2xvY2FsaG9zdDoxMDAxMi9Bc1NDUy9ub3RpZnk"
    }
}
WillusDong commented 10 months ago

Hello @patrice-conil,

Thanks for the quick turnaround, when I tried with this payload and the same configuratioin mentioned earlier, I got this errors - 'Default' client configuration is not initialized.
Any thoughts?

log_default_client.txt

patrice-conil commented 10 months ago

Hi @WillusDong, I think you didn't provide values for CLIENT_ID and CLIENT_SECRET in your env and these values are used to configure oidc client. Hope this helps

WillusDong commented 10 months ago

Thanks @patrice-conil,

If provided, with customized values as follows, the same error returns: export CLIENT_ID=appId; export CLIENT_SECRET=secret; java -jar ./build/camara-qod-0.9.0-runner.jar

Request

curl -X 'POST' \
  'http://192.168.1.43:8080/qod/v0/sessions' \
  -H 'accept: application/json' \
  -H 'X-OAPI-Application-Id: appId' \
  -H 'Content-Type: application/json' \
  -d '{
    "duration": 86400,
    "device": {
        "ipv4Address": {
            "publicAddress": "192.168.0.2"
        }
    },
    "applicationServer": {
        "ipv4Address": "192.168.0.1"
    },
    "devicePorts": {
        "ports": [
            5022
        ]
    },
    "applicationServerPorts": {
        "ports": [
            5010
        ]
    },
    "qosProfile": "vp251iMf1TJiFQq1jpzihd9E9K40.lHI89cTyIdtumWq2VB_cCM4KmUqYvUP8TJCzXab1PvqjaS-vIWwltxHsUjUN",
    "webhook": {
          "notificationUrl": "http://localhost:8080/qosChanged",
          "notificationAuthToken": "L2xvY2FsaG9zdDoxMDAxMi9Bc1NDUy9ub3RpZnk"
    }
}'

LOG log_CLIENT.txt

patrice-conil commented 10 months ago

Hi @WillusDong, I think your scef client config is wrong : https://localhost:8888/http://localhost:8888/apigm should be something like http://localhost:8888/apigm => default client is not initialized.

WillusDong commented 10 months ago

Still getting the same error with suggested change.

Would you provide complete settings that works with wiremock?

Thanks.

patrice-conil commented 10 months ago

Hi @WillusDong, I pushed a new version more user friendly that need no additional config to run and auto-provision redis content. Could you see if it solve your problem?

WillusDong commented 10 months ago

Thanks @patrice-conil Will give it a try and keep you updated.

WillusDong commented 10 months ago

Sorry for the delay, The update makes the deployment much easier, I would just need to make sure that wiremock is listening on port 8888, redis server is listening on localhost:6370, and it works fine.

Thanks.

patrice-conil commented 10 months ago

Hi @WillusDong, You have to download wiremock standalone jar and launch it by hand with something like

java -jar ~/Downloads/wiremock-jre8-standalone-2.35.0.jar --port 8888 --bind-address localhost -vv

from the project's wiremock folder (where __files and mappings reside) Enjoy