Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
Using -re appears to lead to memory leaks in expect, its memory usage keeps going up indefinitely:
Example:
---------------------------------
#!/usr/bin/expect
spawn yes
log_user 0
while 1 {
expect {
-re ".+?\n" {
#
}
}
}
---------------------------------
Running script above for couple seconds leads to:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
19334 root 20 0 1075m 606m 688 R 93.4 69.8 1:44.81 expect
Version-Release number of selected component (if applicable):
expect-5.44.1.15-4.el6.x86_64
How reproducible:
100%
Steps to Reproduce:
1. run attached reproducer
Actual results:
expect memory usage keeps going up
Expected results:
expect memory usage should be stable
Additional info:
Reported also here: http://sourceforge.net/p/expect/patches/13/
The patch from page linked in comment 0 makes the issue go away:
diff --git a/expect.c b/expect.c
index 65e6e04..185f9f3 100644
--- a/expect.c
+++ b/expect.c
@@ -185,9 +185,9 @@ free_ecase(
{
if (ec->i_list->duration == EXP_PERMANENT) {
if (ec->pat) { Tcl_DecrRefCount(ec->pat); }
- if (ec->gate) { Tcl_DecrRefCount(ec->gate); }
if (ec->body) { Tcl_DecrRefCount(ec->body); }
}
+ if (ec->gate) { Tcl_DecrRefCount(ec->gate); }
if (free_ilist) {
ec->i_list->ecount--;
Used memory is holding stable at:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
31889 root 20 0 112m 2308 1796 R 94.5 0.3 1:43.09 expect
Comment 4Vitezslav Crhonek
2013-09-25 11:11:53 UTC
Description of problem: Using -re appears to lead to memory leaks in expect, its memory usage keeps going up indefinitely: Example: --------------------------------- #!/usr/bin/expect spawn yes log_user 0 while 1 { expect { -re ".+?\n" { # } } } --------------------------------- Running script above for couple seconds leads to: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 19334 root 20 0 1075m 606m 688 R 93.4 69.8 1:44.81 expect Version-Release number of selected component (if applicable): expect-5.44.1.15-4.el6.x86_64 How reproducible: 100% Steps to Reproduce: 1. run attached reproducer Actual results: expect memory usage keeps going up Expected results: expect memory usage should be stable Additional info: Reported also here: http://sourceforge.net/p/expect/patches/13/