• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tarantool / tarantool / 8818369172
88%

Build:
DEFAULT BRANCH: master
Ran 24 Apr 2024 02:46PM UTC
Jobs 1
Files 513
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

24 Apr 2024 02:33PM UTC coverage: 87.091% (-0.003%) from 87.094%
8818369172

push

github

Totktonada
popen: add timeout for :wait()

This commit solves several problems:

* Eliminates polling with fiber sleeps for a process status in `:wait()`.
  Now the method waits for libev's SIGCHLD watcher (via a fiber cond).
* Fixes use-after-free and crash/infinite hang in `:wait()` when the
  handle is closed from another fiber.
* Adds `timeout` parameter to `:wait()`.

Popen handles are not reference counted, so the code that waits for a
process completion needs to be a bit tricky to don't access possibly
freed memory. I guess things would be simpler if we implemented
refcounting on the handles, but the same set of problems are generally
solved on the lua/popen side (it tracks `:close()` calls), and I don't
see enough motivation to rearrange it. At least, until we'll create the
handles not only from Lua.

Fixes #4915
Fixes #7653
Fixes #4916

@TarantoolBot document
Title: popen: :wait() now has the timeout parameter

Usage example:

```lua
local ph = popen.new(<...>)
local res, err = ph:wait({timeout = 1})

if res == nil then
    -- Timeout is reached.
    assert(err.type == 'TimedOut')
    <...>
end
```

Also `:wait()` now has defined behavior when the popen handle is closed
from another fiber: the method returns the `ChannelIsClosed` error.

Both updates should have 'Since X.Y.Z' marks in the documentation to
allow users to decide whether to use the new features based on what
tarantool releases should be supported by the calling code. IOW, a user
may lean on the defined close-during-wait behavior or decide to don't.
The same is true for the new timeout option.

See the `lbox_popen_wait()` comment for the updated formal description
of the `<popen handle>:wait(<...>)` method.

67394 of 119817 branches covered (56.25%)

46 of 46 new or added lines in 2 files covered. (100.0%)

32 existing lines in 10 files now uncovered.

100129 of 114971 relevant lines covered (87.09%)

2434381.09 hits per line

Jobs
ID Job ID Ran Files Coverage
1 8818369172.1 24 Apr 2024 02:46PM UTC 0
87.09
GitHub Action Run
Source Files on build 8818369172
Detailed source file information is not available for this build.
  • Back to Repo
  • 735b0dce on github
  • Prev Build on master (#8814273163)
  • Next Build on master (#8859387946)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc