This is part of a tclsh script that I am running as a systemd service
in Linux.
set command "|env TZ=UTC vmstat -n -S M -t ${::runLength} ${count}"
set vmstat [open ${command} RDONLY]
...
close ${vmstat}
Sometimes there is two seconds between:
puts "Stopped vmstat run"
and:
puts "Wait for begin minute"
The first could be on the end of the second and the second at the
begin of a second, but that still means that there is more as a second between those two. That seems a lot of time for the close.
Is something wrong here, or is this normal?
(Most of the time the two statements are executed in the same second.)
Cecil Westerhof <[email protected]> wrote:
This is part of a tclsh script that I am running as a systemd service
in Linux.
set command "|env TZ=UTC vmstat -n -S M -t ${::runLength} ${count}" >> set vmstat [open ${command} RDONLY]
...
close ${vmstat}
Sometimes there is two seconds between:
puts "Stopped vmstat run"
and:
puts "Wait for begin minute"
The first could be on the end of the second and the second at the
begin of a second, but that still means that there is more as a second
between those two. That seems a lot of time for the close.
Is something wrong here, or is this normal?
(Most of the time the two statements are executed in the same second.)
From "man n close":
If channelId is a blocking channel for a command pipeline then
close waits for the child processes to complete.
You are closing a command pipeline, and the code you show did not set non-blocking mode. The extra time you are seeing is probably vmstat
sleep jitter (i.e., it sometimes takes vmstat an extra second before it learns its stdout has disappeared and exits).
Rich <[email protected]d> writes:
Cecil Westerhof <[email protected]> wrote:
This is part of a tclsh script that I am running as a systemd service
in Linux.
set command "|env TZ=UTC vmstat -n -S M -t ${::runLength} ${count}" >>> set vmstat [open ${command} RDONLY]
...
close ${vmstat}
Sometimes there is two seconds between:
puts "Stopped vmstat run"
and:
puts "Wait for begin minute"
The first could be on the end of the second and the second at the
begin of a second, but that still means that there is more as a second
between those two. That seems a lot of time for the close.
Is something wrong here, or is this normal?
(Most of the time the two statements are executed in the same second.)
From "man n close":
If channelId is a blocking channel for a command pipeline then
close waits for the child processes to complete.
You are closing a command pipeline, and the code you show did not set
non-blocking mode. The extra time you are seeing is probably vmstat
sleep jitter (i.e., it sometimes takes vmstat an extra second before it
learns its stdout has disappeared and exits).
But when I am closing the process it is already finished. It still can
happen then?
It is not really important, but I was just wondering. (When I see
something 'strange', I like to know the reason for it.) I think I will
keep it this way, because with non-blocking I do not get an error.
Should never happen, but if the 'impossible' happens, I want to know
about it.
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 33:17:30 |
| Calls: | 12,109 |
| Files: | 15,006 |
| Messages: | 6,518,314 |