CotEditor
CotEditor copied to clipboard
Application stops responding when open files are changed externally at a slow rate
Description
Application stops responding when open files are changed externally.
More specifically, when they are written by an external app at a slow rate.
To Reproduce
- Open a large file
- Whilst the file is open rewrite it at a slow rate
- app stops responding
Using attached files
- extract files crash-bundle.zip
- in terminal run
./crash.sh
This does
- opens two documents
- rewrite slowly both files one at a time
- app stops responding
Source code
crash.sh to open files and then write to those open files
linesPerSecond=500
echo "opening files"
cot macuser.txt nikkei.txt
echo "rewriting macuser.txt"
./catLPS.pl $linesPerSecond original.macuser.txt > macuser.txt
echo "rewriting nikkei.txt"
./catLPS.pl $linesPerSecond original.nikkei.txt > nikkei.txt
catLPS.pl to write a file at specific lines per second
#!/usr/bin/perl -w
use strict;
use Time::HiRes qw|time|;
my $start=time;
my $lps=300;
$lps=shift @ARGV if @ARGV && $ARGV[0]=~/^(\d+)$/;
my $sleepPerLine=1/$lps;
print &&
select undef,undef,undef,($start + $sleepPerLine*$. - Time::HiRes::time)
while <>
Expected behavior
- app should not stop responding
CotEditor version
4.0.8 (471)
macOS version
11.6 (20G165)
Additional context
- Sample of CotEditor.txt
- In real life I encounter this by rewriting a large directory listing whilst it is open
- Note that if you change
linesPerSecondto something higher, say 2000, the app will not crash