Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/renderer neutral #220

Merged
merged 6 commits into from
Mar 6, 2019
Merged

Dev/renderer neutral #220

merged 6 commits into from
Mar 6, 2019

Conversation

felixse
Copy link
Owner

@felixse felixse commented Mar 5, 2019

  • Improved architecture to support different renderers
  • both input and output buffer is now kept in utf8 for the most part, less conversions that might delay
  • possibly fixed a race condition, could be Not working properly #206 and similar

@felixse felixse merged commit d52860e into master Mar 6, 2019
@ericcornelissen
Copy link
Contributor

I'm not entirely sure how it relates to the changes in this PR (quite a lot has changed so it's hard to pinpoint for me 😅) but with this PR I'm experiencing a few problems that make Fluent Terminal almost unusable.

  • The hamburger-menu button, close-terminal button, and add-new-terminal button don't respond to clicks most of the time. A reliable way to get them to work is by opening a new tab (using Ctrl+T) or switching between tabs (for some reason, clicking the tab itself still works reliably). But then when I type something into the terminal the buttons stop responding again.
  • Interacting with the tray icon when there is no terminal window active crashes the program most of the time. The most reliable way to reproduce is to just start FluentTerminal, close the window and clicking the tray icon.
The program '[24516] FluentTerminal.App.exe' has exited with code 1 (0x1).
The program '[13380] FluentTerminal.SystemTray.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.
  • When I open a second window, close it, and open a second window again it crashes the application. This gives the same error as above.

That being said, I think this may have actually solved #206 🎉 (I occasionally had the problem described there, but relaunching usually solved it)

@felixse
Copy link
Owner Author

felixse commented Mar 8, 2019

  • The hamburger-menu button, close-terminal button, and add-new-terminal button don't respond to clicks most of the time. A reliable way to get them to work is by opening a new tab (using Ctrl+T) or switching between tabs (for some reason, clicking the tab itself still works reliably). But then when I type something into the terminal the buttons stop responding again.

Cannot reproduce this. Maybe the shell process is already dead at this point?

  • Interacting with the tray icon when there is no terminal window active crashes the program most of the time. The most reliable way to reproduce is to just start FluentTerminal, close the window and clicking the tray icon.
The program '[24516] FluentTerminal.App.exe' has exited with code 1 (0x1).
The program '[13380] FluentTerminal.SystemTray.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.
  • When I open a second window, close it, and open a second window again it crashes the application. This gives the same error as above.

I'll have a look at these, thanks for testing 👍

That being said, I think this may have actually solved #206 🎉 (I occasionally had the problem described there, but relaunching usually solved it)

I think it's still alive. But we are in a better position to finally catch this now. Next step is to finally add some logging 😅

@ericcornelissen
Copy link
Contributor

I got one more problem (found this as part of #225), the InputDialog is not responding at all. Typing something just inputs it into the shell, and clicking the buttons does nothing.

Cannot reproduce this. Maybe the shell process is already dead at this point?

You mean as I described in my second point? Not so, other than those UI elements everything works just fine. Maybe the .gif below helps explain my point.

example-ui-fails

I think it's still alive [...]

Too bad... 😕

@felixse
Copy link
Owner Author

felixse commented Mar 10, 2019

@ericcornelissen can you checkout the latest master? I found an issue with the websocket sometimes being called to early which brought us in some funny states. Can you have a look if your issues are still occuring? #216 could be really solved now.

@ericcornelissen
Copy link
Contributor

ericcornelissen commented Mar 10, 2019

@felixse the input dialog from #216 does indeed work, although I did not test that one before, I was referring to the dialog for changing the tab name.

The 'Access violation' errors seem to be fixed. But I'm now having exactly the problem described in #159 😅

And lastly, the UI elements in MainView not responding properly (as seen in the .gif above) is still a problem.

@felixse
Copy link
Owner Author

felixse commented Mar 10, 2019

Never had this UI not responding issue on my side. What version of Windows are you experiencing this with? And you can reproduce #159 after I fixed it? 😟

@ericcornelissen
Copy link
Contributor

The above comment is based on 4e83e66 and my Windows version is 1803 OS Build 17134.590 (home)

@felixse
Copy link
Owner Author

felixse commented Mar 10, 2019

Alright, gonna try this out tomorrow on a 1803 VM. Did you see anything interesting in the new log files?
They are located at C:\Users\$Name\AppData\Local\Packages\53621FSApps.FluentTerminal_87x1pks76srcp\LocalCache\logs

@ericcornelissen
Copy link
Contributor

Not really (now running on 6b64d39), this is the logs from the point that I close the second terminal onwards:

2019-03-11 08:39:18.325 +02:00 [DBG] Sending TerminalExitedRequest: [{"TerminalId":2,"$type":"TerminalExitedRequest"}]
2019-03-11 08:39:18.388 +02:00 [DBG] Received TerminalExitedRequest: [{"TerminalId":2,"$type":"TerminalExitedRequest"}]
2019-03-11 08:39:18.412 +02:00 [DBG] TryClose ApplicationView with Id: [-7735835]
2019-03-11 08:39:18.474 +02:00 [DBG] WebView navigation completed. Target: ["about:blank"]

Also, I'm not 100% sure on how to reproduce this but if Fluent Terminal crashes when I open from the system tray icon it always outputs the error below.

It seems this crash happens when I first reproduce #159 (open new window, close it, have tabs in original window closed), then close the Fluent Terminal window, and finally try to launch from the system tray.

2019-03-10 20:38:55.865 +02:00 [ERR] Unhandled Exception
System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at FluentTerminal.SystemTray.Services.TerminalsManager.CreateTerminal(CreateTerminalRequest request)
   at FluentTerminal.SystemTray.Services.AppCommunicationService.<OnRequestReceived>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

@felixse
Copy link
Owner Author

felixse commented Mar 11, 2019

I can reproduce this on 1803. Must be something about focusing the WebView. Both the edit title dialog and the searchbox are instantly unfocused and it returns to the webview

@felixse
Copy link
Owner Author

felixse commented Mar 11, 2019

Ok, I removed something that looked reasonable but was in fact unnecessary and caused issues on Windows 10 1803. Can you check if it is behaving properly again on your side?

@ericcornelissen
Copy link
Contributor

ericcornelissen commented Mar 12, 2019

Solved the problem on my end as well 👍 Thanks! The #159 problem remains though...

@felixse
Copy link
Owner Author

felixse commented Mar 12, 2019

I cannot reproduce the original #159, but found a new variant:
First window with 2 tabs
create new window, also with 2 tabs
close second window
--> first window stays open, but all tabs are hidden🙄

Are you following the steps from #159 exactly?

@ericcornelissen
Copy link
Contributor

ericcornelissen commented Mar 12, 2019

Hmm 🤔 From my latest testing it seems you are right, more generally whenever the second windows has more than one tab open when it is closed, the tabs (regardless of how many) in the first window are closed but the window stays open.

@felixse
Copy link
Owner Author

felixse commented Mar 12, 2019

I think I fixed it. But don't ask me how exactly 😦

@ericcornelissen
Copy link
Contributor

Doesn't seem to be the case on my end 🤔 Note that I just updated Windows 1809 (OS build 17763.379). Here is clean log of a run that caused the problem. In this case I had just one tab, opened a new window, closed it with only a single tab, and the tab in the first window also closed; but I also tried it with multiple tabs and the same happened.

2019-03-13 14:29:25.343 +02:00 [INF] Initialized
2019-03-13 14:29:25.427 +02:00 [DBG] Created ApplicationViewAdapter for ApplicationView with Id: [-132841]
2019-03-13 14:29:28.427 +02:00 [DBG] XtermTerminalView_Loaded
2019-03-13 14:29:28.662 +02:00 [DBG] WebView navigation completed. Target: ["ms-appx-web://53621fsapps.fluentterminal/Client/index.html"]
2019-03-13 14:29:28.947 +02:00 [DBG] Received GetAvailablePortResponse: [{"Port":49151,"$type":"GetAvailablePortResponse"}]
2019-03-13 14:29:29.098 +02:00 [INF] Server started at ws://127.0.0.1:49151 (actual port 49151)
2019-03-13 14:29:29.159 +02:00 [DBG] WebSocketServer started. Calling connectToWebSocket() now.
2019-03-13 14:29:29.432 +02:00 [DBG] WebSocket open
2019-03-13 14:29:29.437 +02:00 [DBG] Sending CreateTerminalRequest: [{"Id":0,"Size":{"Columns":165,"Rows":54,"$type":"TerminalSize"},"Profile":{"Id":"813f2298-210a-481a-bdbf-c17bc637a3e2","PreInstalled":true,"Name":"Powershell","Arguments":"-nologo","Location":"C:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe","WorkingDirectory":"D:\\Workspace","TabThemeId":0,"LineEndingTranslation":"DoNotModify","TerminalThemeId":"41d2ddb3-fa53-45cb-bd0e-80e9cc55983d","KeyBindings":[],"$type":"ShellProfile"},"SessionType":"WinPty","$type":"CreateTerminalRequest"}]
2019-03-13 14:29:29.670 +02:00 [DBG] Received CreateTerminalResponse: [{"Success":true,"Error":null,"ShellExecutableName":"powershell","$type":"CreateTerminalResponse"}]
2019-03-13 14:29:46.435 +02:00 [DBG] Received keyboard command: '["newWindow"]'
2019-03-13 14:29:46.495 +02:00 [DBG] Created ApplicationViewAdapter for ApplicationView with Id: [-6620881]
2019-03-13 14:29:46.622 +02:00 [DBG] XtermTerminalView_Loaded
2019-03-13 14:29:46.787 +02:00 [DBG] WebView navigation completed. Target: ["ms-appx-web://53621fsapps.fluentterminal/Client/index.html"]
2019-03-13 14:29:46.953 +02:00 [DBG] Received GetAvailablePortResponse: [{"Port":49152,"$type":"GetAvailablePortResponse"}]
2019-03-13 14:29:46.954 +02:00 [INF] Server started at ws://127.0.0.1:49152 (actual port 49152)
2019-03-13 14:29:46.954 +02:00 [DBG] WebSocketServer started. Calling connectToWebSocket() now.
2019-03-13 14:29:47.022 +02:00 [DBG] WebSocket open
2019-03-13 14:29:47.023 +02:00 [DBG] Sending CreateTerminalRequest: [{"Id":1,"Size":{"Columns":165,"Rows":54,"$type":"TerminalSize"},"Profile":{"Id":"813f2298-210a-481a-bdbf-c17bc637a3e2","PreInstalled":true,"Name":"Powershell","Arguments":"-nologo","Location":"C:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe","WorkingDirectory":"D:\\Workspace","TabThemeId":0,"LineEndingTranslation":"DoNotModify","TerminalThemeId":"41d2ddb3-fa53-45cb-bd0e-80e9cc55983d","KeyBindings":[],"$type":"ShellProfile"},"SessionType":"WinPty","$type":"CreateTerminalRequest"}]
2019-03-13 14:29:47.156 +02:00 [DBG] Received CreateTerminalResponse: [{"Success":true,"Error":null,"ShellExecutableName":"powershell","$type":"CreateTerminalResponse"}]
2019-03-13 14:29:56.330 +02:00 [DBG] Sending TerminalExitedRequest: [{"TerminalId":1,"$type":"TerminalExitedRequest"}]
2019-03-13 14:29:56.362 +02:00 [DBG] MainViewModel with ApplicationView Id: [-6620881] closed.
2019-03-13 14:29:56.458 +02:00 [DBG] Received TerminalExitedRequest: [{"TerminalId":1,"$type":"TerminalExitedRequest"}]
2019-03-13 14:29:56.490 +02:00 [DBG] Terminal with Id: [1] closed.
2019-03-13 14:29:56.496 +02:00 [DBG] TryClose ApplicationView with Id: [-6620881]
2019-03-13 14:29:56.542 +02:00 [DBG] MainViewModel with ApplicationView Id: [-132841] closed.
2019-03-13 14:29:56.552 +02:00 [DBG] WebView navigation completed. Target: ["about:blank"]

@ericcornelissen
Copy link
Contributor

I did some debugging and it seems that the fix you added in 4e83e66 is not working properly, _closed is still false after the second window is already closed and as a result TryConsolidateAsync is executed twice...

@felixse
Copy link
Owner Author

felixse commented Mar 14, 2019

Yeah, noticed it's not completely fixed. Occurs to me in around 1 of 10 tries. Does it happen to you all the time? I have no idea whats going on, we seem to end up on the wrong ui thread somehow sometimes

@ericcornelissen
Copy link
Contributor

For me it happens consistently as long as the number of tabs in the second window >= the number of tabs in the first window 😕 If I find the time I will see if I can debug some more but am a little busy these days...

@felixse
Copy link
Owner Author

felixse commented Mar 14, 2019

No problem, thanks for helping me with this 😄
I made a few commits today. Still the same problem, but it's now happening if first window tabs < second window tabs. It's unnerving 🙄

@ericcornelissen
Copy link
Contributor

Hmm 😕 Now the tabs closing problem is no longer consistent as you described two comments ago.

However, now I have the following problem...: start Fluent Terminal, open new window, close the new window (everything is fine), open new window, close the new window. both windows close. Here is a clean log for that

2019-03-15 07:13:17.925 +02:00 [INF] Initialized
2019-03-15 07:13:17.998 +02:00 [DBG] Created ApplicationViewAdapter for ApplicationView with Id: [-527669]
2019-03-15 07:13:19.839 +02:00 [DBG] WebView navigation completed. Target: ["ms-appx-web://53621fsapps.fluentterminal/Client/index.html"]
2019-03-15 07:13:20.059 +02:00 [DBG] Received GetAvailablePortResponse: [{"Port":49151,"$type":"GetAvailablePortResponse"}]
2019-03-15 07:13:20.206 +02:00 [INF] Server started at ws://127.0.0.1:49151 (actual port 49151)
2019-03-15 07:13:20.258 +02:00 [DBG] WebSocketServer started. Calling connectToWebSocket() now.
2019-03-15 07:13:20.489 +02:00 [DBG] WebSocket open
2019-03-15 07:13:20.494 +02:00 [DBG] Sending CreateTerminalRequest: [{"Id":0,"Size":{"Columns":165,"Rows":54,"$type":"TerminalSize"},"Profile":{"Id":"813f2298-210a-481a-bdbf-c17bc637a3e2","PreInstalled":true,"Name":"Powershell","Arguments":"-nologo","Location":"C:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe","WorkingDirectory":"D:\\Workspace","TabThemeId":0,"LineEndingTranslation":"DoNotModify","TerminalThemeId":"41d2ddb3-fa53-45cb-bd0e-80e9cc55983d","KeyBindings":[],"$type":"ShellProfile"},"SessionType":"WinPty","$type":"CreateTerminalRequest"}]
2019-03-15 07:13:20.655 +02:00 [DBG] Received CreateTerminalResponse: [{"Success":true,"Error":null,"ShellExecutableName":"powershell","$type":"CreateTerminalResponse"}]
2019-03-15 07:13:25.319 +02:00 [DBG] Received keyboard command: '["newWindow"]'
2019-03-15 07:13:25.360 +02:00 [DBG] Created ApplicationViewAdapter for ApplicationView with Id: [-527849]
2019-03-15 07:13:25.637 +02:00 [DBG] WebView navigation completed. Target: ["ms-appx-web://53621fsapps.fluentterminal/Client/index.html"]
2019-03-15 07:13:25.720 +02:00 [DBG] Received GetAvailablePortResponse: [{"Port":49152,"$type":"GetAvailablePortResponse"}]
2019-03-15 07:13:25.721 +02:00 [INF] Server started at ws://127.0.0.1:49152 (actual port 49152)
2019-03-15 07:13:25.721 +02:00 [DBG] WebSocketServer started. Calling connectToWebSocket() now.
2019-03-15 07:13:25.723 +02:00 [DBG] WebSocket open
2019-03-15 07:13:25.728 +02:00 [DBG] Sending CreateTerminalRequest: [{"Id":1,"Size":{"Columns":165,"Rows":54,"$type":"TerminalSize"},"Profile":{"Id":"813f2298-210a-481a-bdbf-c17bc637a3e2","PreInstalled":true,"Name":"Powershell","Arguments":"-nologo","Location":"C:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe","WorkingDirectory":"D:\\Workspace","TabThemeId":0,"LineEndingTranslation":"DoNotModify","TerminalThemeId":"41d2ddb3-fa53-45cb-bd0e-80e9cc55983d","KeyBindings":[],"$type":"ShellProfile"},"SessionType":"WinPty","$type":"CreateTerminalRequest"}]
2019-03-15 07:13:25.845 +02:00 [DBG] Received CreateTerminalResponse: [{"Success":true,"Error":null,"ShellExecutableName":"powershell","$type":"CreateTerminalResponse"}]
2019-03-15 07:13:29.992 +02:00 [DBG] Sending TerminalExitedRequest: [{"TerminalId":1,"$type":"TerminalExitedRequest"}]
2019-03-15 07:13:29.999 +02:00 [DBG] Received TerminalExitedRequest: [{"TerminalId":1,"$type":"TerminalExitedRequest"}]
2019-03-15 07:13:30.062 +02:00 [DBG] Terminal with Id: [1] closed.
2019-03-15 07:13:30.066 +02:00 [DBG] TryClose ApplicationView with Id: [-527849]
2019-03-15 07:13:30.103 +02:00 [DBG] WebView navigation completed. Target: ["about:blank"]
2019-03-15 07:13:30.146 +02:00 [DBG] MainViewModel with ApplicationView Id: [-527669] closed.
2019-03-15 07:13:33.250 +02:00 [DBG] WebView navigation completed. Target: ["ms-appx-web://53621fsapps.fluentterminal/Client/index.html"]
2019-03-15 07:13:33.318 +02:00 [DBG] Received GetAvailablePortResponse: [{"Port":49153,"$type":"GetAvailablePortResponse"}]
2019-03-15 07:13:33.318 +02:00 [INF] Server started at ws://127.0.0.1:49153 (actual port 49153)
2019-03-15 07:13:33.318 +02:00 [DBG] WebSocketServer started. Calling connectToWebSocket() now.
2019-03-15 07:13:33.359 +02:00 [DBG] WebSocket open
2019-03-15 07:13:33.359 +02:00 [DBG] Sending CreateTerminalRequest: [{"Id":2,"Size":{"Columns":165,"Rows":54,"$type":"TerminalSize"},"Profile":{"Id":"813f2298-210a-481a-bdbf-c17bc637a3e2","PreInstalled":true,"Name":"Powershell","Arguments":"-nologo","Location":"C:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe","WorkingDirectory":"D:\\Workspace","TabThemeId":0,"LineEndingTranslation":"DoNotModify","TerminalThemeId":"41d2ddb3-fa53-45cb-bd0e-80e9cc55983d","KeyBindings":[],"$type":"ShellProfile"},"SessionType":"WinPty","$type":"CreateTerminalRequest"}]
2019-03-15 07:13:33.483 +02:00 [DBG] Received CreateTerminalResponse: [{"Success":true,"Error":null,"ShellExecutableName":"powershell","$type":"CreateTerminalResponse"}]
2019-03-15 07:13:34.351 +02:00 [DBG] Received keyboard command: '["newWindow"]'
2019-03-15 07:13:34.391 +02:00 [DBG] Created ApplicationViewAdapter for ApplicationView with Id: [-723245]
2019-03-15 07:13:34.655 +02:00 [DBG] WebView navigation completed. Target: ["ms-appx-web://53621fsapps.fluentterminal/Client/index.html"]
2019-03-15 07:13:34.742 +02:00 [DBG] Received GetAvailablePortResponse: [{"Port":49154,"$type":"GetAvailablePortResponse"}]
2019-03-15 07:13:34.742 +02:00 [INF] Server started at ws://127.0.0.1:49154 (actual port 49154)
2019-03-15 07:13:34.743 +02:00 [DBG] WebSocketServer started. Calling connectToWebSocket() now.
2019-03-15 07:13:34.799 +02:00 [DBG] WebSocket open
2019-03-15 07:13:34.801 +02:00 [DBG] Sending CreateTerminalRequest: [{"Id":3,"Size":{"Columns":165,"Rows":54,"$type":"TerminalSize"},"Profile":{"Id":"813f2298-210a-481a-bdbf-c17bc637a3e2","PreInstalled":true,"Name":"Powershell","Arguments":"-nologo","Location":"C:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe","WorkingDirectory":"D:\\Workspace","TabThemeId":0,"LineEndingTranslation":"DoNotModify","TerminalThemeId":"41d2ddb3-fa53-45cb-bd0e-80e9cc55983d","KeyBindings":[],"$type":"ShellProfile"},"SessionType":"WinPty","$type":"CreateTerminalRequest"}]
2019-03-15 07:13:34.923 +02:00 [DBG] Received CreateTerminalResponse: [{"Success":true,"Error":null,"ShellExecutableName":"powershell","$type":"CreateTerminalResponse"}]
2019-03-15 07:13:39.179 +02:00 [DBG] Sending TerminalExitedRequest: [{"TerminalId":3,"$type":"TerminalExitedRequest"}]
2019-03-15 07:13:39.181 +02:00 [DBG] Received TerminalExitedRequest: [{"TerminalId":3,"$type":"TerminalExitedRequest"}]
2019-03-15 07:13:39.190 +02:00 [DBG] Terminal with Id: [3] closed.
2019-03-15 07:13:39.190 +02:00 [DBG] TryClose ApplicationView with Id: [-723245]
2019-03-15 07:13:39.231 +02:00 [DBG] MainViewModel with ApplicationView Id: [-723245] closed.
2019-03-15 07:13:39.240 +02:00 [DBG] WebView navigation completed. Target: ["about:blank"]
2019-03-15 07:13:39.267 +02:00 [DBG] MainViewModel with ApplicationView Id: [-527849] closed.

@felixse
Copy link
Owner Author

felixse commented Mar 17, 2019

I know I keep saying this, but I think I found the issue now 😌 Can you give it another try?

@ericcornelissen
Copy link
Contributor

Seems like it, good job! 😃

@felixse felixse deleted the Dev/RendererNeutral branch March 21, 2019 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants