EVerest / libocpp

C++ implementation of the Open Charge Point Protocol
Apache License 2.0
83 stars 42 forks source link

set_variable_attribute_value triggers "database is locked" #671

Closed lategoodbye closed 3 weeks ago

lategoodbye commented 1 month ago

OCPP Version

OCPP2.0.1

Describe the bug

We noticed the following issue with our Tarragon platform and EVerest core 2024.05. In case we connect an EV and start charging the following errors occur:

2024-06-14T14:58:31.237030+0200 tarragon manager[17482]: [INFO] tarragon_bsp:Cb  :: CP state change from B to C, U_CP+: 5920 mV, U_CP-: -11769 mV
2024-06-14T14:58:31.246550+0200 tarragon manager[17471]: [INFO] connector_1:Evs  ::                                     CAR IEC Event CarRequestedPower
2024-06-14T14:58:31.266938+0200 tarragon manager[17471]: [INFO] connector_1:Evs  :: EVSE IEC Charger state: PrepareCharging->Charging
2024-06-14T14:58:31.324661+0200 tarragon manager[17477]: [WARN] ocpp:OCPP201    types::ocpp::OcppTransactionEvent module::conversions::to_everest_ocpp_transaction_event(const ocpp::v201::TransactionEventRequest&) :: Attempting to convert TransactionEventRequest that does not contain information about the EVSE. evse_id and connector default to 1.
2024-06-14T14:58:31.398807+0200 tarragon manager[17482]: [INFO] tarragon_bsp:Cb  :: Closing contactor...
2024-06-14T14:58:31.500963+0200 tarragon manager[17482]: [INFO] tarragon_bsp:Cb  :: Contactor state: CLOSED
2024-06-14T14:58:31.515515+0200 tarragon manager[17471]: [INFO] connector_1:Evs  :: EVSE IEC Event PowerOn
2024-06-14T14:58:31.580624+0200 tarragon manager[17477]: [WARN] ocpp:OCPP201    types::ocpp::OcppTransactionEvent module::conversions::to_everest_ocpp_transaction_event(const ocpp::v201::TransactionEventRequest&) :: Attempting to convert TransactionEventRequest that does not contain information about the EVSE. evse_id and connector default to 1.
2024-06-14T14:58:53.854375+0200 tarragon manager[17477]: [ERRO] ocpp:OCPP201    virtual bool ocpp::v201::DeviceModelStorageSqlite::set_variable_attribute_value(const ocpp::v201::Component&, const ocpp::v201::Variable&, const ocpp::v201::AttributeEnum&, const string&) :: database is locked
2024-06-14T14:58:53.874179+0200 tarragon manager[17477]: [ERRO] ocpp:OCPP201    virtual ocpp::common::SQLiteStatement::~SQLiteStatement() :: Error finalizing statement: database is locked
2024-06-14T14:58:54.602975+0200 tarragon manager[17477]: [ERRO] ocpp:OCPP201    virtual ocpp::common::SQLiteStatement::~SQLiteStatement() :: Error finalizing statement: database is locked
2024-06-14T14:58:54.606300+0200 tarragon manager[17477]: [ERRO] ocpp:OCPP201    virtual ocpp::common::SQLiteStatement::~SQLiteStatement() :: Error finalizing statement: database is locked

To Reproduce

Configuration:

active_modules:
  api_1:
    module: API
    connections:
      evse_manager:
        - module_id: connector_1
          implementation_id: evse
  api_2:
    module: API
    connections:
      evse_manager:
        - module_id: connector_2
          implementation_id: evse_manager
  tarragon_bsp:
    module: CbTarragonDriver
    config_module:
      contactor_1_feedback_type: nc
      relay_2_name: none
  tarragon_pluglock:
    module: CbTarragonPlugLock
  serialcommhub_x7:
    module: SerialCommHub
    config_implementation:
      main:
        baudrate: 115200
        serial_port: /dev/ttymxc0
        ignore_echo: true
  powermeter:
    module: PowermeterIskra_WM3M4C
    config_implementation:
      main:
        powermeter_device_id: 33
        model: Iskra_WM3M4_WM3M4C
        modbus_base_address: 30000
    connections:
      serial_comm_hub:
        - module_id: serialcommhub_x7
          implementation_id: main
  token_provider_1:
    config_implementation:
      main:
        timeout: 10
        token: deadbeef 
        type: RFID
    connections:
      evse:
        - implementation_id: evse
          module_id: connector_1
    module: DummyTokenProvider
  token_provider_2:
    config_implementation:
      main:
        timeout: 10
        token: 2e7b711a 
        type: RFID
    connections:
      evse:
        - implementation_id: evse_manager
          module_id: connector_2
    module: DummyTokenProvider
  connector_1:
    module: EvseManager
    config_module:
      connector_id: 1
      has_ventilation: false
      max_current_import_A: 16
      session_logging: true
    connections:
      bsp:
        - module_id: tarragon_bsp
          implementation_id: evse_board_support
      connector_lock:
        - module_id: tarragon_pluglock
          implementation_id: connector_lock
      powermeter_grid_side:
        - module_id: powermeter
          implementation_id: main
  connector_2:
    module: SatelliteController
    config_module:
      hostname: "192.168.1.11"
    connections:
      auth:
        - module_id: auth
          implementation_id: main
      system:
        - module_id: system_aggregator
          implementation_id: system
  system_aggregator:
    module: SystemAggregator
    connections:
      system:
        - module_id: system
          implementation_id: main
        - module_id: connector_2
          implementation_id: system
      satellite:
        - module_id: connector_2
          implementation_id: satellite
  energy_manager:
    module: EnergyManager
    connections:
      energy_trunk:
        - module_id: grid_connection_point
          implementation_id: energy_grid
  grid_connection_point:
    module: EnergyNode
    config_module:
      fuse_limit_A: 16
      phase_count: 3
    connections:
      energy_consumer:
        - module_id: connector_1
          implementation_id: energy_grid
        - module_id: connector_2
          implementation_id: energy
  auth:
    module: Auth
    config_module:
      connection_timeout: 10
      prioritize_authorization_over_stopping_transaction: true
      selection_algorithm: PlugEvents
    connections:
      token_provider:
        - module_id: token_provider_1
          implementation_id: main
        - module_id: token_provider_2
          implementation_id: main
        - module_id: ocpp
          implementation_id: auth_provider
      token_validator:
        - module_id: ocpp
          implementation_id: auth_validator
      evse_manager:
        - module_id: connector_1
          implementation_id: evse
        - module_id: connector_2
          implementation_id: evse_manager
  evse_security:
    module: EvseSecurity
  system:
    module: CbSystem
  ocpp:
    module: OCPP201
    config_module:
      CoreDatabasePath: /var/lib/everest/ocpp201
      DeviceModelDatabasePath: /var/lib/everest/ocpp201/cp.db
    connections:
      evse_manager:
        - module_id: connector_1
          implementation_id: evse
        - module_id: connector_2
          implementation_id: evse_manager
      auth:
        - module_id: auth
          implementation_id: main
      security:
        - module_id: evse_security
          implementation_id: main
      system:
        - module_id: system_aggregator
          implementation_id: system
  hmiled:
    module: GpioRgbLed
    config_module:
      led_red_gpio_line_name: DIGITAL_OUT_3
      led_green_gpio_line_name: DIGITAL_OUT_1
      led_blue_gpio_line_name: DIGITAL_OUT_2
    connections:
      auth:
        - module_id: auth
          implementation_id: main
      bsp:
        - module_id: tarragon_bsp
          implementation_id: evse_board_support
      evse:
        - module_id: connector_1
          implementation_id: evse
      system:
        - module_id: system_aggregator
          implementation_id: system

Anything else?

No response

AssemblyJohn commented 1 month ago

Hello!

There seems to be a problem with the fact that we are not using transactions. A fix will be available soon.

AssemblyJohn commented 1 month ago

Should be fixed with: https://github.com/EVerest/libocpp/pull/675