Revert "bound the event channel to prevent unbounded RSS growth"

This commit is contained in:
Michael Murphy 2026-05-18 16:30:51 +02:00 • committed by GitHub
parent cf059265f8
commit 3bd221e3e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 14 deletions

View file

@ -438,7 +438,7 @@ pub enum Message {
TabNext, TabNext,
TabPrev, TabPrev,
TermEvent(pane_grid::Pane, segmented_button::Entity, TermEvent), TermEvent(pane_grid::Pane, segmented_button::Entity, TermEvent),
TermEventTx(mpsc::Sender<(pane_grid::Pane, segmented_button::Entity, TermEvent)>), TermEventTx(mpsc::UnboundedSender<(pane_grid::Pane, segmented_button::Entity, TermEvent)>),
ToggleFullscreen, ToggleFullscreen,
ToggleContextPage(ContextPage), ToggleContextPage(ContextPage),
UpdateDefaultProfile((bool, ProfileId)), UpdateDefaultProfile((bool, ProfileId)),
@ -502,7 +502,8 @@ pub struct App {
find: bool, find: bool,
find_search_id: widget::Id, find_search_id: widget::Id,
find_search_value: String, find_search_value: String,
term_event_tx_opt: Option<mpsc::Sender<(pane_grid::Pane, segmented_button::Entity, TermEvent)>>, term_event_tx_opt:
Option<mpsc::UnboundedSender<(pane_grid::Pane, segmented_button::Entity, TermEvent)>>,
startup_options: Option<tty::Options>, startup_options: Option<tty::Options>,
term_config: term::Config, term_config: term::Config,
color_scheme_errors: Vec<String>, color_scheme_errors: Vec<String>,
@ -3622,11 +3623,7 @@ impl Application for App {
stream::channel( stream::channel(
100, 100,
|mut output: iced::futures::channel::mpsc::Sender<Message>| async move { |mut output: iced::futures::channel::mpsc::Sender<Message>| async move {
// Bounded: when the GUI can't drain fast enough, alacritty's PTY reader let (event_tx, mut event_rx) = mpsc::unbounded_channel();
// blocks on send → kernel pipe fills → producing program is throttled by
// the OS. Capacity 1024 caps the queue depth; per-event memory depends on
// payload (Wakeup is ~100 B; Title/PtyWrite carry owned Strings).
let (event_tx, mut event_rx) = mpsc::channel(1024);
output.send(Message::TermEventTx(event_tx)).await.unwrap(); output.send(Message::TermEventTx(event_tx)).await.unwrap();
while let Some((pane, entity, event)) = event_rx.recv().await { while let Some((pane, entity, event)) = event_rx.recv().await {

View file

@ -99,16 +99,13 @@ impl From<Size> for WindowSize {
pub struct EventProxy( pub struct EventProxy(
pane_grid::Pane, pane_grid::Pane,
segmented_button::Entity, segmented_button::Entity,
mpsc::Sender<(pane_grid::Pane, segmented_button::Entity, Event)>, mpsc::UnboundedSender<(pane_grid::Pane, segmented_button::Entity, Event)>,
); );
impl EventListener for EventProxy { impl EventListener for EventProxy {
fn send_event(&self, event: Event) { fn send_event(&self, event: Event) {
// Bounded channel; blocking_send propagates backpressure to alacritty's //TODO: handle error
// PTY reader instead of letting events accumulate. Called from alacritty's let _ = self.2.send((self.0, self.1, event));
// std::thread PTY reader (not a tokio worker), so blocking is safe and
// blocking_send won't panic.
let _ = self.2.blocking_send((self.0, self.1, event));
} }
} }
@ -273,7 +270,7 @@ impl Terminal {
pub fn new( pub fn new(
pane: pane_grid::Pane, pane: pane_grid::Pane,
entity: segmented_button::Entity, entity: segmented_button::Entity,
event_tx: mpsc::Sender<(pane_grid::Pane, segmented_button::Entity, Event)>, event_tx: mpsc::UnboundedSender<(pane_grid::Pane, segmented_button::Entity, Event)>,
config: Config, config: Config,
options: Options, options: Options,
app_config: &AppConfig, app_config: &AppConfig,