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

Module config update doesn't work as expected #89

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mnosov
Copy link

@mnosov mnosov commented Apr 8, 2020

How to reproduce:
Build Flexisip with SNMP support

snmpset -m FLEXISIP-MIB -v 2c -c private localhost FLEXISIP-MIB::flexisipMIB.flexisip.module..0 s

Verify that log "Congiguration of module changed for key...." but module is not reloaded

Root cause:

bool dirtyConfig=false is local variable.
When doConfigStateChanged is called twice with Changed->Committed - old value of local variable 'dirtyConfig' is destroyed

Fix:

Make dirtyConfig flag as a Module class member.
This is the easiest but not perfect solution as it affects all 'derived' classes (need to recompile all modules)
Anyway I don't see acceptable fix for this without affecting public header "module.hh"

Better suggestions:

To avoid adding members to public classes, I'd recommend to use 'private implementation' approach for storing all 'Module' internals

How to reproduce:
Build Flexisip with SNMP support

snmpset -m FLEXISIP-MIB  -v 2c -c private localhost FLEXISIP-MIB::flexisipMIB.flexisip.module<someModule>.<someSetting>.0 s <someValue>

Verify that log "Congiguration of module <name> changed for key...." but module is not reloaded

Root cause:
----------
bool dirtyConfig=false is local variable.
When doConfigStateChanged is called twice with Changed->Committed - old value of local variable 'dirtyConfig' is destroyed

Fix:
----
Make dirtyConfig flag as a Module class member.
This is the easiest but not perfect solution as it affects all 'derived' classes (need to recompile all modules)
Anyway I don't see acceptable fix for this without affecting public header "module.hh"

Better suggestions:
-----
To avoid adding members to public classes, I'd recommend to use 'private implementation' approach for storing all 'Module' internals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants