Skip to content

Commit

Permalink
Merge pull request containers#16781 from matejvasek/fix-event-reading…
Browse files Browse the repository at this point in the history
…-size

fix: event read from syslog when syslog entry too long
  • Loading branch information
openshift-merge-robot authored Dec 16, 2022
2 parents ecc095d + 80405a2 commit d6c2fa6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libpod/events/journal_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ func (e EventJournalD) Read(ctx context.Context, options ReadOptions) error {
logrus.Errorf("Unable to close journal :%v", err)
}
}()
err = j.SetDataThreshold(0)
if err != nil {
logrus.Warnf("cannot set data threshold: %v", err)
}
// match only podman journal entries
podmanJournal := sdjournal.Match{Field: "SYSLOG_IDENTIFIER", Value: "podman"}
if err := j.AddMatch(podmanJournal.String()); err != nil {
Expand Down
23 changes: 23 additions & 0 deletions test/python/docker/compat/test_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"""
import io
import tarfile
import threading
import time
from typing import IO, List, Optional

from docker import errors
Expand Down Expand Up @@ -260,3 +262,24 @@ def test_mount_rw_by_default(self):
ctr.remove()
if vol is not None:
vol.remove(force=True)

def test_wait_next_exit(self):
self.skipTest("Skip until fix container-selinux#196 is available.")
ctr: Container = self.docker.containers.create(
image=constant.ALPINE,
name="test-exit",
command=["true"],
labels={"my-label": "0" * 250_000})

try:
def wait_and_start():
time.sleep(5)
ctr.start()

t = threading.Thread(target=wait_and_start)
t.start()
ctr.wait(condition="next-exit", timeout=300)
t.join()
finally:
ctr.stop()
ctr.remove(force=True)

0 comments on commit d6c2fa6

Please sign in to comment.