fnmatch is not thread safe

Bug #1519767 reported by ZhiQiang Fan on 2015-11-25
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
High
ZhiQiang Fan
Kilo
New
Undecided
Unassigned
Liberty
Fix Committed
Undecided
gordon chung

Bug Description

We are using fnmatch for many places but never guarantee for thread safe, for example, in gnocchi dispatcher, here is a race condition example in CI: http://logs.openstack.org/32/243032/3/check/gate-ceilometer-dsvm-integration/a3c96a6/logs/screen-ceilometer-collector.txt.gz?#_2015-11-24_19_20_40_087

We should add some locks or simplify it with string compare if we could

Aodh also uses it, but only in evaluator, and that has no thread race IIUC.

ZhiQiang Fan (aji-zqfan) wrote :

python 3.x is not affected

Changed in ceilometer:
assignee: nobody → ZhiQiang Fan (aji-zqfan)

Fix proposed to branch: master
Review: https://review.openstack.org/249764

Changed in ceilometer:
status: New → In Progress

Reviewed: https://review.openstack.org/249764
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=5acc00c179f109eacb174856e58f75dba1ce73cc
Submitter: Jenkins
Branch: master

commit 5acc00c179f109eacb174856e58f75dba1ce73cc
Author: ZhiQiang Fan <email address hidden>
Date: Thu Nov 26 04:45:04 2015 +0800

    re-implement thread safe fnmatch

    fnmatch is not thread safe for versions <= 2.7.9. We have used
    it in some places without any lock for concurrency scenario. This patch
    re-implements a thread safe match() which is very similar to fnmatch by
    using its translate function.

    Change-Id: I4b6c2ea72841201519144eb09ecf8c82b16b6143
    ref: https://hg.python.org/cpython/rev/fe12c34c39eb
    Closes-Bug: #1519767

Changed in ceilometer:
status: In Progress → Fix Committed
gordon chung (chungg) on 2015-11-26
Changed in ceilometer:
importance: Undecided → High

Reviewed: https://review.openstack.org/250531
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=82b76dcf67d8eaea9752042e92dcabb9397f61c0
Submitter: Jenkins
Branch: stable/liberty

commit 82b76dcf67d8eaea9752042e92dcabb9397f61c0
Author: gordon chung <email address hidden>
Date: Thu Nov 26 16:03:30 2015 -0500

    re-implement thread safe fnmatch

    fnmatch is not thread safe for versions <= 2.7.9. We have used
    it in some places without any lock for concurrency scenario. This patch
    re-implements a thread safe match() which is very similar to fnmatch by
    using its translate function.

    Co-Authored-By: ZhiQiang Fan <email address hidden>
    Change-Id: I4b6c2ea72841201519144eb09ecf8c82b16b6143
    ref: https://hg.python.org/cpython/rev/fe12c34c39eb
    Closes-Bug: #1519767

This issue was fixed in the openstack/ceilometer 6.0.0.0b1 development milestone.

Thierry Carrez (ttx) on 2015-12-03
Changed in ceilometer:
status: Fix Committed → Fix Released

This issue was fixed in the openstack/ceilometer 5.0.1 release.

Liusheng (liusheng) on 2015-12-10
Changed in ceilometer:
milestone: none → mitaka-1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers