Skip to content

Commit 692172c

Browse files
add pid awareness to file locking (#33169)
* add pid awareness to file locking * cleanup, logic for handling restarts with the same PID * add zombie-state awareness * fix file naming * add retry for unlock * was confused by unlock code, fix, cleanup * update notice * fix race with file creation, update deps * clean up tests, spelling * hack for cgo * add lic headers * notice * try to fix windows issues * fix typos * small fixes * use exclusive locks * remove feature to start with a specially named pidfile * clean up some error handling, fix test cleanup * forgot changelog
1 parent 8eb69da commit 692172c

File tree

11 files changed

+587
-173
lines changed

11 files changed

+587
-173
lines changed

CHANGELOG.next.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ https://github.com/elastic/beats/compare/v8.2.0\...main[Check the HEAD diff]
122122

123123
*Affecting all Beats*
124124

125+
- Beats will now attempt to recover if a lockfile has not been removed {pull}[33169]
126+
125127

126128
*Auditbeat*
127129

NOTICE.txt

Lines changed: 82 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10414,11 +10414,11 @@ these terms.
1041410414

1041510415
--------------------------------------------------------------------------------
1041610416
Dependency : github.com/elastic/elastic-agent-system-metrics
10417-
Version: v0.4.4
10417+
Version: v0.4.5-0.20220927192933-25a985b07d51
1041810418
Licence type (autodetected): Apache-2.0
1041910419
--------------------------------------------------------------------------------
1042010420

10421-
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-system-metrics@v0.4.4/LICENSE.txt:
10421+
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-system-metrics@v0.4.5-0.20220927192933-25a985b07d51/LICENSE.txt:
1042210422

1042310423
Apache License
1042410424
Version 2.0, January 2004
@@ -17199,11 +17199,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1719917199

1720017200
--------------------------------------------------------------------------------
1720117201
Dependency : github.com/magefile/mage
17202-
Version: v1.13.0
17202+
Version: v1.14.0
1720317203
Licence type (autodetected): Apache-2.0
1720417204
--------------------------------------------------------------------------------
1720517205

17206-
Contents of probable licence file $GOMODCACHE/github.com/magefile/mage@v1.13.0/LICENSE:
17206+
Contents of probable licence file $GOMODCACHE/github.com/magefile/mage@v1.14.0/LICENSE:
1720717207

1720817208
Apache License
1720917209
Version 2.0, January 2004
@@ -19373,11 +19373,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1937319373

1937419374
--------------------------------------------------------------------------------
1937519375
Dependency : github.com/stretchr/testify
19376-
Version: v1.7.1
19376+
Version: v1.8.0
1937719377
Licence type (autodetected): MIT
1937819378
--------------------------------------------------------------------------------
1937919379

19380-
Contents of probable licence file $GOMODCACHE/github.com/stretchr/testify@v1.7.1/LICENSE:
19380+
Contents of probable licence file $GOMODCACHE/github.com/stretchr/testify@v1.8.0/LICENSE:
1938119381

1938219382
MIT License
1938319383

@@ -21378,11 +21378,11 @@ Contents of probable licence file $GOMODCACHE/go.mongodb.org/mongo-driver@v1.5.1
2137821378

2137921379
--------------------------------------------------------------------------------
2138021380
Dependency : go.uber.org/atomic
21381-
Version: v1.9.0
21381+
Version: v1.10.0
2138221382
Licence type (autodetected): MIT
2138321383
--------------------------------------------------------------------------------
2138421384

21385-
Contents of probable licence file $GOMODCACHE/go.uber.org/atomic@v1.9.0/LICENSE.txt:
21385+
Contents of probable licence file $GOMODCACHE/go.uber.org/atomic@v1.10.0/LICENSE.txt:
2138621386

2138721387
Copyright (c) 2016 Uber Technologies, Inc.
2138821388

@@ -21436,11 +21436,11 @@ THE SOFTWARE.
2143621436

2143721437
--------------------------------------------------------------------------------
2143821438
Dependency : go.uber.org/zap
21439-
Version: v1.21.0
21439+
Version: v1.23.0
2144021440
Licence type (autodetected): MIT
2144121441
--------------------------------------------------------------------------------
2144221442

21443-
Contents of probable licence file $GOMODCACHE/go.uber.org/zap@v1.21.0/LICENSE.txt:
21443+
Contents of probable licence file $GOMODCACHE/go.uber.org/zap@v1.23.0/LICENSE.txt:
2144421444

2144521445
Copyright (c) 2016-2017 Uber Technologies, Inc.
2144621446

@@ -42826,6 +42826,76 @@ DEALINGS IN THE SOFTWARE.
4282642826

4282742827

4282842828

42829+
--------------------------------------------------------------------------------
42830+
Dependency : github.com/shirou/gopsutil
42831+
Version: v3.21.11+incompatible
42832+
Licence type (autodetected): BSD-3-Clause
42833+
--------------------------------------------------------------------------------
42834+
42835+
Contents of probable licence file $GOMODCACHE/github.com/shirou/gopsutil@v3.21.11+incompatible/LICENSE:
42836+
42837+
gopsutil is distributed under BSD license reproduced below.
42838+
42839+
Copyright (c) 2014, WAKAYAMA Shirou
42840+
All rights reserved.
42841+
42842+
Redistribution and use in source and binary forms, with or without modification,
42843+
are permitted provided that the following conditions are met:
42844+
42845+
* Redistributions of source code must retain the above copyright notice, this
42846+
list of conditions and the following disclaimer.
42847+
* Redistributions in binary form must reproduce the above copyright notice,
42848+
this list of conditions and the following disclaimer in the documentation
42849+
and/or other materials provided with the distribution.
42850+
* Neither the name of the gopsutil authors nor the names of its contributors
42851+
may be used to endorse or promote products derived from this software without
42852+
specific prior written permission.
42853+
42854+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
42855+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
42856+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
42857+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
42858+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
42859+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42860+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
42861+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
42862+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42863+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42864+
42865+
42866+
-------
42867+
internal/common/binary.go in the gopsutil is copied and modifid from golang/encoding/binary.go.
42868+
42869+
42870+
42871+
Copyright (c) 2009 The Go Authors. All rights reserved.
42872+
42873+
Redistribution and use in source and binary forms, with or without
42874+
modification, are permitted provided that the following conditions are
42875+
met:
42876+
42877+
* Redistributions of source code must retain the above copyright
42878+
notice, this list of conditions and the following disclaimer.
42879+
* Redistributions in binary form must reproduce the above
42880+
copyright notice, this list of conditions and the following disclaimer
42881+
in the documentation and/or other materials provided with the
42882+
distribution.
42883+
* Neither the name of Google Inc. nor the names of its
42884+
contributors may be used to endorse or promote products derived from
42885+
this software without specific prior written permission.
42886+
42887+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
42888+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42889+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
42890+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
42891+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42892+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42893+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42894+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
42895+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
42896+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
42897+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42898+
4282942899
--------------------------------------------------------------------------------
4283042900
Dependency : github.com/sirupsen/logrus
4283142901
Version: v1.8.1
@@ -42959,11 +43029,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4295943029

4296043030
--------------------------------------------------------------------------------
4296143031
Dependency : github.com/stretchr/objx
42962-
Version: v0.2.0
43032+
Version: v0.4.0
4296343033
Licence type (autodetected): MIT
4296443034
--------------------------------------------------------------------------------
4296543035

42966-
Contents of probable licence file $GOMODCACHE/github.com/stretchr/objx@v0.2.0/LICENSE:
43036+
Contents of probable licence file $GOMODCACHE/github.com/stretchr/objx@v0.4.0/LICENSE:
4296743037

4296843038
The MIT License
4296943039

go.mod

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ require (
117117
github.com/jonboulle/clockwork v0.2.2
118118
github.com/josephspurrier/goversioninfo v0.0.0-20190209210621-63e6d1acd3dd
119119
github.com/lib/pq v1.10.3
120-
github.com/magefile/mage v1.13.0
120+
github.com/magefile/mage v1.14.0
121121
github.com/mattn/go-colorable v0.1.12
122122
github.com/mattn/go-ieproxy v0.0.0-20191113090002-7c0f6868bffe // indirect
123123
github.com/miekg/dns v1.1.42
@@ -141,7 +141,7 @@ require (
141141
github.com/shopspring/decimal v1.2.0
142142
github.com/spf13/cobra v1.3.0
143143
github.com/spf13/pflag v1.0.5
144-
github.com/stretchr/testify v1.7.1
144+
github.com/stretchr/testify v1.8.0
145145
github.com/tsg/go-daemon v0.0.0-20200207173439-e704b93fd89b
146146
github.com/ugorji/go/codec v1.1.8
147147
github.com/urso/sderr v0.0.0-20210525210834-52b04e8f5c71
@@ -150,9 +150,9 @@ require (
150150
go.elastic.co/ecszap v1.0.1
151151
go.elastic.co/go-licence-detector v0.5.0
152152
go.etcd.io/bbolt v1.3.6
153-
go.uber.org/atomic v1.9.0
153+
go.uber.org/atomic v1.10.0
154154
go.uber.org/multierr v1.8.0
155-
go.uber.org/zap v1.21.0
155+
go.uber.org/zap v1.23.0
156156
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
157157
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
158158
golang.org/x/mod v0.5.1
@@ -194,7 +194,7 @@ require (
194194
github.com/elastic/elastic-agent-autodiscover v0.4.0
195195
github.com/elastic/elastic-agent-libs v0.2.11
196196
github.com/elastic/elastic-agent-shipper-client v0.4.0
197-
github.com/elastic/elastic-agent-system-metrics v0.4.4
197+
github.com/elastic/elastic-agent-system-metrics v0.4.5-0.20220927192933-25a985b07d51
198198
github.com/elastic/go-elasticsearch/v8 v8.2.0
199199
github.com/googleapis/gax-go/v2 v2.5.1
200200
github.com/pierrec/lz4/v4 v4.1.15
@@ -308,8 +308,9 @@ require (
308308
github.com/sanathkr/go-yaml v0.0.0-20170819195128-ed9d249f429b // indirect
309309
github.com/santhosh-tekuri/jsonschema v1.2.4 // indirect
310310
github.com/sergi/go-diff v1.1.0 // indirect
311+
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
311312
github.com/sirupsen/logrus v1.8.1 // indirect
312-
github.com/stretchr/objx v0.2.0 // indirect
313+
github.com/stretchr/objx v0.4.0 // indirect
313314
github.com/tklauser/go-sysconf v0.3.9 // indirect
314315
github.com/tklauser/numcpus v0.3.0 // indirect
315316
github.com/urso/diag v0.0.0-20200210123136-21b3cc8eb797 // indirect

go.sum

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,8 @@ github.com/elastic/elastic-agent-libs v0.2.11 h1:ZeYn35Kxt+IdtMPmE01TaDeaahCg/z7
621621
github.com/elastic/elastic-agent-libs v0.2.11/go.mod h1:chO3rtcLyGlKi9S0iGVZhYCzDfdDsAQYBc+ui588AFE=
622622
github.com/elastic/elastic-agent-shipper-client v0.4.0 h1:nsTJF9oo4RHLl+zxFUZqNHaE86C6Ba5aImfegcEf6Sk=
623623
github.com/elastic/elastic-agent-shipper-client v0.4.0/go.mod h1:OyI2W+Mv3JxlkEF3OeT7K0dbuxvwew8ke2Cf4HpLa9Q=
624-
github.com/elastic/elastic-agent-system-metrics v0.4.4 h1:Br3S+TlBhijrLysOvbHscFhgQ00X/trDT5VEnOau0E0=
625-
github.com/elastic/elastic-agent-system-metrics v0.4.4/go.mod h1:tF/f9Off38nfzTZHIVQ++FkXrDm9keFhFpJ+3pQ00iI=
624+
github.com/elastic/elastic-agent-system-metrics v0.4.5-0.20220927192933-25a985b07d51 h1:ZFk7hC6eRPJkJNtOSG+GYbRlsgLjSD8rTj4gQq+7rsA=
625+
github.com/elastic/elastic-agent-system-metrics v0.4.5-0.20220927192933-25a985b07d51/go.mod h1:vTqfhtj83LlPKbusEwrEywZv13nhPExwINB3PkeRQeo=
626626
github.com/elastic/elastic-transport-go/v8 v8.1.0 h1:NeqEz1ty4RQz+TVbUrpSU7pZ48XkzGWQj02k5koahIE=
627627
github.com/elastic/elastic-transport-go/v8 v8.1.0/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI=
628628
github.com/elastic/fsevents v0.0.0-20181029231046-e1d381a4d270 h1:cWPqxlPtir4RoQVCpGSRXmLqjEHpJKbR60rxh1nQZY4=
@@ -1281,8 +1281,8 @@ github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc8
12811281
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
12821282
github.com/magefile/mage v1.9.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
12831283
github.com/magefile/mage v1.12.1/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
1284-
github.com/magefile/mage v1.13.0 h1:XtLJl8bcCM7EFoO8FyH8XK3t7G5hQAeK+i4tq+veT9M=
1285-
github.com/magefile/mage v1.13.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
1284+
github.com/magefile/mage v1.14.0 h1:6QDX3g6z1YvJ4olPhT1wksUcSa/V0a1B+pJb73fBjyo=
1285+
github.com/magefile/mage v1.14.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
12861286
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
12871287
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
12881288
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
@@ -1632,6 +1632,8 @@ github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfP
16321632
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
16331633
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
16341634
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
1635+
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
1636+
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
16351637
github.com/shirou/gopsutil/v3 v3.21.12 h1:VoGxEW2hpmz0Vt3wUvHIl9fquzYLNpVpgNNB7pGJimA=
16361638
github.com/shirou/gopsutil/v3 v3.21.12/go.mod h1:BToYZVTlSVlfazpDDYFnsVZLaoRG+g8ufT6fPQLdJzA=
16371639
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
@@ -1692,8 +1694,9 @@ github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5J
16921694
github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
16931695
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
16941696
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
1695-
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
16961697
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
1698+
github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=
1699+
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
16971700
github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
16981701
github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
16991702
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
@@ -1703,8 +1706,9 @@ github.com/stretchr/testify v1.5.0/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
17031706
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
17041707
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
17051708
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
1706-
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
17071709
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
1710+
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
1711+
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
17081712
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
17091713
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
17101714
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
@@ -1849,8 +1853,9 @@ go.uber.org/atomic v1.5.1/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
18491853
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
18501854
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
18511855
go.uber.org/atomic v1.8.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
1852-
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
18531856
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
1857+
go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
1858+
go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
18541859
go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
18551860
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
18561861
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
@@ -1871,8 +1876,9 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
18711876
go.uber.org/zap v1.14.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
18721877
go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
18731878
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
1874-
go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8=
18751879
go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
1880+
go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY=
1881+
go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY=
18761882
golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
18771883
golang.org/x/crypto v0.0.0-20180505025534-4ec37c66abab/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
18781884
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=

libbeat/cmd/instance/beat.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import (
4444
"github.com/elastic/beats/v7/libbeat/beat"
4545
"github.com/elastic/beats/v7/libbeat/cfgfile"
4646
"github.com/elastic/beats/v7/libbeat/cloudid"
47+
"github.com/elastic/beats/v7/libbeat/cmd/instance/locks"
4748
"github.com/elastic/beats/v7/libbeat/common"
4849
"github.com/elastic/beats/v7/libbeat/common/reload"
4950
"github.com/elastic/beats/v7/libbeat/common/seccomp"
@@ -385,13 +386,13 @@ func (b *Beat) launch(settings Settings, bt beat.Creator) error {
385386

386387
// Try to acquire exclusive lock on data path to prevent another beat instance
387388
// sharing same data path.
388-
bl := newLocker(b)
389-
err := bl.lock()
389+
bl := locks.New(b.Info)
390+
err := bl.Lock()
390391
if err != nil {
391392
return err
392393
}
393394
defer func() {
394-
_ = bl.unlock()
395+
_ = bl.Unlock()
395396
}()
396397

397398
svc.BeforeRun()

libbeat/cmd/instance/locker.go

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)