File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 3434 otelContextMappingSize = 2 * os .Getpagesize ()
3535
3636 existingMappingBytes []byte
37+ publisherPID int
3738)
3839
3940type processContextHeader struct {
@@ -45,12 +46,14 @@ type processContextHeader struct {
4546}
4647
4748func CreateOtelProcessContextMapping (data []byte ) error {
48- if existingMappingBytes != nil {
49+ if existingMappingBytes != nil && publisherPID == os . Getpid () {
4950 // Unmap the previous mapping if it exists
5051 err := unix .Munmap (existingMappingBytes )
5152 if err != nil {
5253 return fmt .Errorf ("failed to munmap previous mapping: %w" , err )
5354 }
55+ existingMappingBytes = nil
56+ publisherPID = 0
5457 }
5558
5659 headerSize := int (unsafe .Sizeof (processContextHeader {}))
@@ -106,5 +109,6 @@ func CreateOtelProcessContextMapping(data []byte) error {
106109 )
107110
108111 existingMappingBytes = mappingBytes
112+ publisherPID = os .Getpid ()
109113 return nil
110114}
You can’t perform that action at this time.
0 commit comments