Skip to content

sonic-sai-vm may open wrong SQL database. #14

@mabnhdev

Description

@mabnhdev

In sai_vm_db_init(), the db_path to the DB is acquired from the SAI_DB_CONFIG_FILE. The db_path string is defined to be a constant obtained from the config file. The db_path should only be considered valid as long as the config file is open. At end of the sai_vm_db_init(), the function used db_path to open the database AFTER the config file is closed. This is a bug - you are only getting away with it on Debian because the garbage collection is not aggressive. On Ubuntu 16.04, you end up using a garbage DB name.

I suggest you move the config file close to the end of the function or, at least, after the final reference to any constant string derived from the config file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions