fnmatch is not thread safe

Bug #1519767 reported by ZhiQiang Fan
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.

Revision history for this message
ZhiQiang Fan (aji-zqfan) wrote :

python 3.x is not affected

Changed in ceilometer:
assignee: nobody → ZhiQiang Fan (aji-zqfan)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ceilometer (master)

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

Changed in ceilometer:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

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)
Changed in ceilometer:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ceilometer (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/250531

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (stable/liberty)

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

Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/ceilometer 6.0.0.0b1

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

Thierry Carrez (ttx)
Changed in ceilometer:
status: Fix Committed → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/ceilometer 5.0.1

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

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.