Hi,

If I open a specific file over tramp and then trigger window redisplay, either by resizing the window or splitting the window, then emacs hangs or sometimes crashes. Can be reproduced consistently by just opening the specific file over tramp and then "C-x 3". Same file, if I open locally (without tramp), it does not crash on window resize.

Please find the specific file that causes the crash attached to this email. Steps to reproduce:
- place the file on a remote machine
- start emacs
- open file using tramp like /ssh:1.1.1.1:/tmp/test.txt
- split the window with C-x 3
====> emacs hangs or crashes at this point

I have seen this issue on macos with different versions of emacs (26.3, 27.1, 27.2) and with different versions of tramp as well. Please find below the stack trace I collected. Also, just for testing, I removed everything from .emacs to see if it is something in my .emacs, but it still crashed or hung.

===============================================================
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00000001001a11c5 emacs`builtin_lisp_symbol(index=<unavailable>) at lisp.h:1033:10 [opt]
    frame #1: 0x00000001001a0e10 emacs`NILP(x=0x0000000000000000) at lisp.h:1400:10 [opt]
    frame #2: 0x00000001001a566a emacs`CHAR_TABLE_REF_ASCII(ct=0x0000000102613d85, idx=110) at lisp.h:2040:11 [opt]
    frame #3: 0x00000001001a1061 emacs`CHAR_TABLE_REF(ct=<unavailable>, idx=<unavailable>) at lisp.h:2054:6 [opt]
    frame #4: 0x00000001001a25ec emacs`composition_compute_stop_pos(cmp_it=<unavailable>, charpos=9242, bytepos=<unavailable>, endpos=<unavailable>, string=<unavailable>) at composite.c:1024:10 [opt]
    frame #5: 0x0000000100044cf1 emacs`compute_stop_pos(it=<unavailable>) at xdisp.c:3960:7 [opt]
    frame #6: 0x00000001000441a2 emacs`handle_stop(it=0x00007ffeefbf9e28) at xdisp.c:3820:5 [opt]
    frame #7: 0x00000001000475c6 emacs`next_element_from_buffer(it=0x00007ffeefbf9e28) at xdisp.c:8791:4 [opt]
    frame #8: 0x000000010001ea5a emacs`get_next_display_element(it=0x00007ffeefbf9e28) at xdisp.c:7383:15 [opt]
    frame #9: 0x000000010002eadf emacs`display_line(it=<unavailable>, cursor_vpos=<unavailable>) at xdisp.c:23248:12 [opt]
    frame #10: 0x000000010002e549 emacs`try_window(window=0x0000000101153835, pos=<unavailable>, flags=1) at xdisp.c:19199:11 [opt]
    frame #11: 0x0000000100050ff0 emacs`redisplay_window(window=0x0000000101153835, just_this_one_p=false) at xdisp.c:18617:8 [opt]
    frame #12: 0x000000010004fb76 emacs`redisplay_window_0(window=<unavailable>) at xdisp.c:16331:5 [opt]
    frame #13: 0x0000000100144d96 emacs`internal_condition_case_1(bfun=(emacs`redisplay_window_0 at xdisp.c:16329), arg=0x0000000101153835, handlers=<unavailable>, hfun=(emacs`redisplay_window_error at xdisp.c:16322)) at eval.c:1380:25 [opt]
    frame #14: 0x000000010004ed54 emacs`redisplay_windows(window=0x0000000101153835) at xdisp.c:16311:4 [opt]
    frame #15: 0x000000010002b640 emacs`redisplay_internal at xdisp.c:15779:5 [opt]
    frame #16: 0x000000010002d991 emacs`redisplay_preserve_echo_area(from_where=8) at xdisp.c:16128:7 [opt]
    frame #17: 0x00000001000c4fa3 emacs`detect_input_pending_run_timers(do_display=true) at keyboard.c:10371:5 [opt]
    frame #18: 0x0000000100189ed4 emacs`wait_reading_process_output(time_limit=<unavailable>, nsecs=0, read_kbd=<unavailable>, do_display=true, wait_for_cell=0x0000000000000000, wait_proc=<unavailable>, just_wait_proc=0) at process.c:5708:8 [opt]
    frame #19: 0x0000000100008bed emacs`sit_for(timeout=<unavailable>, reading=<unavailable>, display_option=<unavailable>) at dispnew.c:6064:3 [opt]
    frame #20: 0x00000001000c41f7 emacs`read_char(commandflag=1, map=0x0000000124027103, prev_event=0x0000000000000000, used_mouse_menu=0x00007ffeefbff467, end_time=0x0000000000000000) at keyboard.c:2738:11 [opt]
    frame #21: 0x00000001000c0d83 emacs`read_key_sequence(keybuf=<unavailable>, prompt=0x0000000000000000, dont_downcase_last=false, can_return_switch_frame=false, fix_current_buffer=true, prevent_redisplay=false) at keyboard.c:9554:12 [opt]
    frame #22: 0x00000001000bff33 emacs`command_loop_1 at keyboard.c:1350:15 [opt]
    frame #23: 0x0000000100144d22 emacs`internal_condition_case(bfun=(emacs`command_loop_1 at keyboard.c:1236), handlers=<unavailable>, hfun=(emacs`cmd_error at keyboard.c:919)) at eval.c:1356:25 [opt]
    frame #24: 0x00000001000cecae emacs`command_loop_2(ignore=0x0000000000000000) at keyboard.c:1091:11 [opt]
    frame #25: 0x00000001001448cb emacs`internal_catch(tag=<unavailable>, func=(emacs`command_loop_2 at keyboard.c:1087), arg=0x0000000000000000) at eval.c:1117:25 [opt]
    frame #26: 0x00000001001f7e2a emacs`command_loop.cold.1 at keyboard.c:1070:2 [opt]
    frame #27: 0x00000001000bf42e emacs`command_loop at keyboard.c:0 [opt]
    frame #28: 0x00000001000bf354 emacs`recursive_edit_1 at keyboard.c:714:9 [opt]
    frame #29: 0x00000001000bf55e emacs`Frecursive_edit at keyboard.c:786:3 [opt]
    frame #30: 0x00000001000bd818 emacs`main(argc=<unavailable>, argv=0x00007ffeefbff888) at emacs.c:2067:3 [opt]
    frame #31: 0x00007fff203bbf3d libdyld.dylib`start + 1
    frame #32: 0x00007fff203bbf3d libdyld.dylib`start + 1
===============================================================

In GNU Emacs 27.2 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95))
of 2021-03-27 built on builder10-14.porkrind.org
Windowing system distributor 'Apple', version 10.3.2022
System Description:  macOS 11.3.1

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Quit
Configured using:
'configure --with-ns '--enable-locallisppath=/Library/Application
Support/Emacs/${version}/site-lisp:/Library/Application
Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES
THREADS JSON PDUMPER GMP

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/Users/mkancherla/.emacs.d/elpa/tramp-2.5.1.1/tramp-archive hides /Applications/Emacs2.app/Contents/Resources/lisp/net/tramp-archive
/Users/mkancherla/.emacs.d/elpa/tramp-2.5.1.1/tramp-smb hides /Applications/Emacs2.app/Contents/Resources/lisp/net/tramp-smb
/Users/mkancherla/.emacs.d/elpa/tramp-2.5.1.1/tramp-uu hides /Applications/Emacs2.app/Contents/Resources/lisp/net/tramp-uu
/Users/mkancherla/.emacs.d/elpa/tramp-2.5.1.1/tramp hides /Applications/Emacs2.app/Contents/Resources/lisp/net/tramp
/Users/mkancherla/.emacs.d/elpa/tramp-2.5.1.1/tramp-adb hides /Applications/Emacs2.app/Contents/Resources/lisp/net/tramp-adb
/Users/mkancherla/.emacs.d/elpa/tramp-2.5.1.1/tramp-sh hides /Applications/Emacs2.app/Contents/Resources/lisp/net/tramp-sh
/Users/mkancherla/.emacs.d/elpa/tramp-2.5.1.1/trampver hides /Applications/Emacs2.app/Contents/Resources/lisp/net/trampver
/Users/mkancherla/.emacs.d/elpa/tramp-2.5.1.1/tramp-cmds hides /Applications/Emacs2.app/Contents/Resources/lisp/net/tramp-cmds
/Users/mkancherla/.emacs.d/elpa/tramp-2.5.1.1/tramp-integration hides /Applications/Emacs2.app/Contents/Resources/lisp/net/tramp-integration
/Users/mkancherla/.emacs.d/elpa/tramp-2.5.1.1/tramp-sudoedit hides /Applications/Emacs2.app/Contents/Resources/lisp/net/tramp-sudoedit
/Users/mkancherla/.emacs.d/elpa/tramp-2.5.1.1/tramp-cache hides /Applications/Emacs2.app/Contents/Resources/lisp/net/tramp-cache
/Users/mkancherla/.emacs.d/elpa/tramp-2.5.1.1/tramp-compat hides /Applications/Emacs2.app/Contents/Resources/lisp/net/tramp-compat
/Users/mkancherla/.emacs.d/elpa/tramp-2.5.1.1/tramp-gvfs hides /Applications/Emacs2.app/Contents/Resources/lisp/net/tramp-gvfs
/Users/mkancherla/.emacs.d/elpa/tramp-2.5.1.1/tramp-ftp hides /Applications/Emacs2.app/Contents/Resources/lisp/net/tramp-ftp
/Users/mkancherla/.emacs.d/elpa/tramp-2.5.1.1/tramp-rclone hides /Applications/Emacs2.app/Contents/Resources/lisp/net/tramp-rclone
/Users/mkancherla/.emacs.d/elpa/tramp-2.5.1.1/tramp-loaddefs hides /Applications/Emacs2.app/Contents/Resources/lisp/net/tramp-loaddefs

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml mml-sec epa derived epg epg-config gnus-util
rmail rmail-loaddefs text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils finder-inf info
package easymenu browse-url url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core term/tty-colors frame
minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite charscript charprop case-table epa-hook jka-cmpr-hook help
simple abbrev obarray cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
threads kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 69254 6106)
(symbols 48 8166 1)
(strings 32 24442 1598)
(string-bytes 1 759163)
(vectors 16 13863)
(vector-slots 8 171466 13674)
(floats 8 24 21)
(intervals 56 192 0)
(buffers 1000 12))