Bug 24986 - Doing scalar(`ag -s '[ \\t]' .`) in perl causes the system to freeze
Summary: Doing scalar(`ag -s '[ \\t]' .`) in perl causes the system to freeze
Status: NEW
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: x86_64 Linux
Priority: Normal critical
Target Milestone: ---
Assignee: Kernel and Drivers maintainers
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-21 12:06 CEST by Shlomi Fish
Modified: 2020-08-21 11:05 CEST (History)
1 user (show)

See Also:
Source RPM: kernel-5.1.11-1.mga7.src.rpm
CVE:
Status comment:


Attachments

Description Shlomi Fish 2019-06-21 12:06:33 CEST
Description of problem:

I wrote some misguided perl 5 code to search for trailing space which causes the RAM consumption to balloon and the system to freeze. Tried doing 
ulimit -Hm $((3500 * 1024)) in zsh and it did not help:

The code is:

```
#!/usr/bin/perl

use strict;
use warnings;

use Test::More tests => 1;

# TEST
like( scalar(`ag -s '[ \\t]' .`),
    qr#\A[\r\n]*\z#, "No trailing space was found." );
```

Version-Release number of selected component (if applicable):

mga7

How reproducible:

always

Steps to Reproduce:
1. urpmi perl perl-Test-More the_silver_searcher
2. Run the code e.g in a https://github.com/shlomif/freecell-pro-0fc-deals clone.

I have 7-8 GB of ram and 64 gb of swap.
3.
Comment 1 Marja Van Waes 2019-06-23 18:48:51 CEST
Assigning to the kernel maintainers, because Shlomi assigned it to kernel-5.1.11-1.mga7.src.rpm

Assignee: bugsquad => kernel
CC: (none) => marja11

Comment 2 Shlomi Fish 2020-08-21 11:05:28 CEST
Replying to myself, I'd like to note that using "ulimit -H -d" appears to help:

```
ulimit -H -d $((1000 * 1000))
perl ~/consume-ram.pl
```

maybe "-m" is not enforced.

Note You need to log in before you can comment on or make changes to this bug.