StackStorm / StackStorm/st2

Stackstorm fails to start 4 components if there are multiple PTR records associated with server

Open
#4,161 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

ISSUE TYPE
  • Bug Report
STACKSTORM VERSION
st2 2.7.2, on Python 2.7
OS / ENVIRONMENT / INSTALL METHOD

CentOS 6, custom install

SUMMARY

If the server where you run st2 has multiple PTR records associated with, few components fail to start:
st2notifier
st2rulesengine
st2garbagecollector
(forgot which one was the 4th)

Reason is socket.fqdn() returns different name each time invoked (round robin, probably). And Stackstorm is registering options twice on start. That creates a DuplicateOptError exception.

STEPS TO REPRODUCE
1. Add one or more PTR records for the IP address of your server. So it looks like this:
$ host 10.142.18.192
192.18.142.10.in-addr.arpa domain name pointer server1.example.com.
192.18.142.10.in-addr.arpa domain name pointer www.example.com.
192.18.142.10.in-addr.arpa domain name pointer ftp.example.com.

2. Try to start /opt/stackstorm/st2/bin/st2notifier --help
EXPECTED RESULTS

It should print help with no errors and exceptions.

ACTUAL RESULTS
$ /opt/stackstorm/st2/bin/st2notifier --help
Traceback (most recent call last):
  File "./st2notifier", line 18, in <module>
    from st2actions.cmd import st2notifier
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2actions/cmd/st2notifier.py", line 13, in <module>
    from st2actions.notifier import config
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2actions/notifier/config.py", line 60, in <module>
    register_opts()
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2actions/notifier/config.py", line 31, in register_opts
    _register_common_opts()
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2actions/notifier/config.py", line 40, in _register_common_opts
    common_config.register_opts()
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2common/config.py", line 117, in register_opts
    do_register_opts(webui_opts, 'webui', ignore_errors)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2common/config.py", line 30, in do_register_opts
    cfg.CONF.register_opts(opts, group=group)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/oslo_config/cfg.py", line 1820, in __inner
    result = f(self, *args, **kwargs)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/oslo_config/cfg.py", line 1977, in register_opts
    self.register_opt(opt, group, clear_cache=False)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/oslo_config/cfg.py", line 1824, in __inner
    return f(self, *args, **kwargs)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/oslo_config/cfg.py", line 1961, in register_opt
    return group._register_opt(opt, cli)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/oslo_config/cfg.py", line 1344, in _register_opt
    if _is_opt_registered(self._opts, opt):
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/oslo_config/cfg.py", line 574, in _is_opt_registered
    raise DuplicateOptError(opt.name)
oslo_config.cfg.DuplicateOptError: duplicate option: webui_base_url

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the st2notifier entry point and the files st2actions/notifier/config.py and st2common/config.py named in the traceback. Reproduce the failure with multiple PTR records and /opt/stackstorm/st2/bin/st2notifier --help, then trace the repeated option registration. Done means st2notifier and the other affected components start without DuplicateOptError and help prints successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python
Domain
backend, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.