typora / typora-issues

Bugs, suggestions or free discussions about the minimal markdown editor — Typora
https://typora.io
1.53k stars 58 forks source link

OS X Catalina: Typora Freezes Indefinitely #3279

Closed rhagl closed 4 years ago

rhagl commented 4 years ago

Hello,

I'm experiencing an issue with the OS X Beta build (version 0.9.9.31.7) of Typora where the editor freezes unexpectedly and I have to restart the program. While frozen, I cannot select any area in the editor nor can I insert any characters. There's no apparent pattern to what action triggers the error or cadence of when the error occurs. The other actions still appear to work but are delayed (for example, after clicking on File, it takes about 5 seconds for the menu to open, during which the color-wheel spinner appears in place of my cursor). If I click Save after opening the menu, the UI appears as if it completed the action, but none of my edits save.

Unfortunately, this renders Typora unusable for me, as I'd lose work too often.

WOWNICE commented 4 years ago

I got the same issue as you.

The reason for this problem seems to be unreasonable memory usage by Typora:

I found almost 9G (precisely 9.3G) of memory usage when it's frozen.

typora
GindaChen commented 4 years ago

Same. Though I didn't experience the huge memory usage as @WOWNICE . It usually happens when you write some, save, and write some, and save - boom it freeze.

skrenek commented 4 years ago

I'm not sure if this is the same issue, but it feels similar. For me it only occurred when I added an image to a small document via a URL. As soon as I added the image CPU usage went to 100%+ until I force quit the app.

The doc does have

    ---
    typora-copy-images-to: .
    ---

in it.

After removing the image from the document via another editor and then re-opening the doc in Typora, the CPU usage was normal. I tried adding the image again, and CPU usage again went up. I removed the image again and re-added it, and this time when pasting in the URL I got the pop-up menu to save the image locally, and now no more CPU usage.
Version 0.9.9.31.7 (4087)

Update: Still occurring. On further analysis, it's when the image is clicked on that the CPU usage begins.

rhagl commented 4 years ago

Hmm, @WOWNICE . I'm not running into an issue where my memory use is spiking (any more than I'd expect from an Electron-based app), as you are, but I was able to recreate the error and capture some info about my CPU usage, as @GindaChen mentioned. When I snapped the shot, Activity Monitor said that Typora was using 96.1% of my CPU (see attached), like @skrenek reported; however, I was able to elicit the error just by adding text, moving my cursor around, and clicking on and off the editor. I did that for about 3 minutes before the error occurred. I haven't attempted to add an image to a doc yet, but I'll try that next.

Screen Shot 2020-02-18 at 6 44 55 PM
GindaChen commented 4 years ago

More info:

  1. My renderer works fine, and I didn't observe a high usage of CPU nor memory. I was guessing maybe I usually killed the process within 10 secs of its no response, and I frequently save document so this happens once in a while with minimum changes of the document.
  2. After hitting save and freeze, forcing typora to close, in most cases, will not lose any change of the document. Sometimes it will lost some of the changes before the last save, but never the entire document
abnerlee commented 4 years ago

Which theme do you use? Possible to send us(hi@typora.io) a sample file?

tingiris commented 4 years ago

I'm getting the same behavior - where the memory and CPU usage spike and I have to kill the process to do anything further. In my case, it seems to happen when I try to copy and paste. I'm using macOS Catalina 10.15.3 and Typora Version 0.9.9.31.7 (4087) with the Github theme.

I really love Typora but this is happening so often now that it's become unusable. I hope there is a fix soon. Please let me know if I can provide anything more that would be helpful.

Screen Shot 2020-02-20 at 9 36 18 AM Screen Shot 2020-02-20 at 9 35 55 AM
mire3212 commented 4 years ago

I also experience this issue. It seems to trigger easily if I use the 'find' feature, although it also just happens intermittently as I'm using the app. I observed that after hitting command-f to search in a (relatively small doc consisting of two tables, one about 50 rows, 2 columns and the other 5 rows and 2 columns) that the CPU usage jumped to 100% and stayed there, while memory consumption immediately start increasing at a rate of roughly 50MB per second, growing from around 2GB to top out at about 15GB before I quit the application (~15 minutes). During this time, the app was completely unresponsive.

I'd be happy to provide any logs if instructions can be provided on how to do so. macOS 10.14.6 Typora 0.9.9.31.7 (4087) Nightly theme.

skrenek commented 4 years ago

Which theme do you use?

I'm using the stock Pixyll theme. If it's any consolation, I'm wondering if it may be an underlying Electron bug, as I noticed VS Code doing the same thing in the past few days, though not as often.

GindaChen commented 4 years ago

I try many themes and they exhibit the same behaviour. (Github, Pixyll, Ursing Polar, etc)

abnerlee commented 4 years ago

It's still difficult for us to reproduce this, can you reproduce it? if so, possible to send us a screen cast (hi@typora.io) about how to reproduce this issue @GindaChen @tingiris?

Aslo, does older versions (like 0.9.9.30.1 https://typora.io/download/Typora-0.9.9.31.3.dmg) works without those issues under your macOS system?

dcstrange commented 4 years ago

I downgraded from the latest version with memory and cpu overhead issues to the 0.9.9.26.7 (3550) version which has no "web content“ background process and it has worked well so far.

jayge-ekenstam commented 4 years ago

I think that this is the same issue I was seeing on 0.9.9.31.6 (4047). Here is a link to that issue.

For me it happened most often when doing anything with images (usually for the second time). Then the CPU usage would spike and I would not be able to do anything.

I went back to Version 0.9.9.31.4 (4005) in order to not see this issue anymore.

Ezzahhh commented 4 years ago

I get this issue by just playing around with diagrams and then the whole application would freeze. Attempting to quit works, but otherwise everything else is unresponsive; funny enough Cmd+Q will still prompt to save the file despite the rest of the application is hung.

GindaChen commented 4 years ago

I just realize it is only with math formular (mathjax) that Typora could freeze when save.

First, I hit these definition at the very top of my document as shortcuts for latex

$$
% Math Symbols
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Zz}{\mathbb{Z_0}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\F}{\mathbb{F}}

\newcommand{\f}[2]{\frac{#1}{#2}}
\newcommand{\e}[1][-1]{^{#1}}

% Format Symbols
\newcommand{\ex}{\exist}
\newcommand{\al}{\forall}
\newcommand{\ss}[1]{\{#1\}}
\newcommand{\tt}[1]{\text{#1}}
\newcommand{\bk}[1]{\lang#1\rang}
\newcommand{\ord}[1]{|#1|}

% Similar: \sim = similar
% Mapping symbols: \mapsto, \gets
\newcommand{\la}{\leftarrow}
\newcommand{\LA}{\Leftarrow}
\newcommand{\ra}{\rightarrow}
\newcommand{\RA}{\Rightarrow}
\newcommand{\LRA}{\Leftrightarrow}
\newcommand{\lra}{\leftrightarrow}
\newcommand{\mapsto}{\to}
\newcommand{\from}{\gets}
\newcommand{\emp}{\varnothing}

% Greek Letters
\newcommand{\a}{\alpha}
\newcommand{\b}{\beta}
\newcommand{\r}{\gamma}
\newcommand{\p}{\phi}

\newcommand{\cr}{\circ}

\newcommand{\im}{\text{im}}
\newcommand{\ng}{\trianglelefteq}

% Isomorphism
\newcommand{\sb}{\subseteq}
$$

Then try to type the following text, save it once a while you finish typing an equation:

# Isomorphism Theorem

[toc]

## The first isomorphism theorem

> If $\p : G \ra H$ is homomorphism, then $\ker \p \ng G$ and $G / \ker\p \cong \p(G)$

## The second isomorphism theorem (DIamond)

> Let $G$ be a group and $A,B \le G$. Assume that $A \le N_G(B)$, and $B \le N_G(B)$ trivially. Then it follows
>
> (1) $AB \le N_G(B)$, i.e. $B$ is the normal subgroup of $AB$. 
>
> (2) $B \ng AB$
>
> (3) $A \cap B \ng A$
>
> (4) $AB/B \cong A/ (A\cap B)$

## The third isomorphism theorem

> Let $H, K \ng G$ and $H \le K$. Then we have that $H/K \ng G/H$ and $(G/H)/(K/H) \cong G/K$

Claim: 

(1) $K/H \ng G/H$:
$$
(gH)(k/H)(gH)^{-1} = (k/H)
$$

(2) Define $\p: G/H \ra G/K$. Then $\p$ is well defined with 
$$
gH \ra gK
$$

as $g_1H = g_2 H \RA g_1 = g_2$, and $h\in K \RA g_1K = g_2 K$

The kernel
$$
\ker \p = \ss{gH | \p(gH) = K} = \ss{gH | \p(gK) = K} = \ss{gH | g \in K} = K/H
$$
Therefore by the first isomorphism theorem, 
$$
(G/H) / \ker \p = (G/H) / (K/H) \cong \p(G) \cong G/K
$$

I managed to freeze Typora every time I hit a save button

mire3212 commented 4 years ago

I have not experienced the issues after downgrading to 0.9.9.30.1

abnerlee commented 4 years ago

I fixed the freeze on open folder and mouse click. But I'm not able to reproduce the "freeze on save" one.

Please check if it still exists on v0.9.9.32