The Wayback Machine - http://web.archive.org/web/20201016114019/https://github.com/saltstack/salt/issues/57828
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

[BUG] spurious "invalid cache mtime entry" warning every minute with colon in filename #57828

Open
wchao opened this issue Jun 28, 2020 · 5 comments · May be fixed by #57893
Open

[BUG] spurious "invalid cache mtime entry" warning every minute with colon in filename #57828

wchao opened this issue Jun 28, 2020 · 5 comments · May be fixed by #57893

Comments

@wchao
Copy link

@wchao wchao commented Jun 28, 2020

Description
I get the following warnings once a minute:

2020-06-23 23:11:13,900 [salt.loaded.int.fileserver.roots:180 ][WARNING ][24993] Skipped invalid cache mtime entry in /var/cache/salt/master/roots/mtime_map: /srv/salt/a/b/c/ifcfg-eth0:0:1533517049.0

2020-06-23 23:11:13,901 [salt.loaded.int.fileserver.roots:180 ][WARNING ][24993] Skipped invalid cache mtime entry in /var/cache/salt/master/roots/mtime_map: /srv/salt/x/y/z/ifcfg-eth0:0:1526301738.0

2020-06-23 23:11:13,905 [salt.loaded.int.fileserver.roots:180 ][WARNING ][24993] Skipped invalid cache mtime entry in /var/cache/salt/master/roots/mtime_map: /srv/salt/dns/zone/1111:2222.zone:1592913957.1986542

2020-06-23 23:11:13,905 [salt.loaded.int.fileserver.roots:180 ][WARNING ][24993] Skipped invalid cache mtime entry in /var/cache/salt/master/roots/mtime_map: /srv/salt/dns/zone/3333:4444.zone:1592913957.1986542

Setup
Just name a file under /srv/salt using a colon somewhere in the filename.

Steps to Reproduce the behavior
Just name a file under /srv/salt using a colon somewhere in the filename.

Expected behavior
Only real warnings about invalid cache mtime entries should be emitted, not spurious ones that are due to a bug in the code that incorrectly parses the line.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
           Salt: 3001

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.7.3
      docker-py: Not Installed
          gitdb: 2.0.5
      gitpython: 2.1.11
         Jinja2: 2.10
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: Not Installed
   pycryptodome: 3.6.1
         pygit2: Not Installed
         Python: 3.7.3 (default, Dec 20 2019, 18:57:59)
   python-gnupg: Not Installed
         PyYAML: 3.13
          PyZMQ: 17.1.2
          smmap: 2.0.5
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.3.1

System Versions:
           dist: debian 10 buster
         locale: UTF-8
        machine: x86_64
        release: 4.19.0-9-amd64
         system: Linux
        version: Debian GNU/Linux 10 buster

Additional context
The problem is pretty easy to spot in the code, and I think also pretty easy to fix. The issue is on line 170 in salt.loaded.int.fileserver.roots (version 3001):

file_path, mtime = line.replace("\n", "").split(":", 1)

When a file path has a colon, the operation barfs because it splits in the wrong place. Just try it on the examples above. The solution is to replace the split method with rsplit or rpartition.

I'm happy to have someone make the change, or also happy to contribute the fix if that's easier (if so, how do I do that? I'm familiar with Python, but not github for pull requests).

@wchao wchao added the Bug label Jun 28, 2020
@cmcmarrow cmcmarrow added this to the Approved milestone Jun 29, 2020
@cmcmarrow
Copy link
Contributor

@cmcmarrow cmcmarrow commented Jun 29, 2020

@wchao thanks for the report! A simple rsplit should do the trick like you said. If you want to put in a fix for this feel free to slack me on saltstackcommunity.slack.com my user name is Charles McMarrow. I will be happy to help with github and Salt questions.

@wchao
Copy link
Author

@wchao wchao commented Jun 29, 2020

Hi @cmcmarrow , I tried to access saltstackcommunity.slack.com, but was unable. When I visit that page, I can't log in with my usual Slack credentials, and I can't create new credentials because it requires that I have an @saltstack.com email address. How do I access the Slack page or community that you mention?

@cmcmarrow
Copy link
Contributor

@cmcmarrow cmcmarrow commented Jul 1, 2020

@wchao Sorry about that! I should have given you this link https://saltstackcommunity.herokuapp.com/

@cmcmarrow
Copy link
Contributor

@cmcmarrow cmcmarrow commented Jul 1, 2020

@terminalmage
Copy link
Collaborator

@terminalmage terminalmage commented Jul 9, 2020

Fixed in #57893.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

6 participants
You can’t perform that action at this time.