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

User Consent Pop up in end machine is hanging #6290

Open
mdshoaibumer opened this issue Jul 30, 2024 · 29 comments
Open

User Consent Pop up in end machine is hanging #6290

mdshoaibumer opened this issue Jul 30, 2024 · 29 comments
Assignees
Labels

Comments

@mdshoaibumer
Copy link

mdshoaibumer commented Jul 30, 2024

Dear @Ylianst
We have enabled User Consent for Desktop, Terminal, and File Transfer. When we click the connect button, the user consent pop-up appears on the end machine. However, the user is unable to approve the request because the pop-up either hangs or does not load properly.

Steps to reproduce the behavior:

  1. Enable User Consent for a group/one machine.
  2. Click on Desktop/Terminal/File transfer connect button.
  3. Check in end machine where popup appears as expected.

Expected behavior
We expect the Popup to be displayed properly without hanging.

Screenshots
Screenshot 2024-07-22 164343
Screenshot 2024-07-22 164434
Screenshot 2024-07-22 165426
Screenshot 2024-07-22 165317

OS: Microsoft Windows Server 2016
MeshCentral Version: v1.1.24
Node: v20.14.0

Client Device:

  • Device: Laptop/Desktop
  • OS: windows 10/11

In the attached screenshots , we can see that MeshAgent.exe is generating sub process, but its not able to display the Pop up and Event viewer is reporting Application hang issue.

I ran the MeshAgent.exe in admin command prompt it was throwing that error as shown in image.

Kindly help me on this.

@si458
Copy link
Collaborator

si458 commented Jul 30, 2024

i have spotted this in one of my machines, but it only happens once in a blue moon, and never been able to replicate it
but thanks for the idea to run in console mode and check the windows event log!

one fix i found was to use service restart in the console tab, which will restart the meshagent, then suddenly it will start working again

something is happening in the consent panel to cause these errors, just need to track it down now
(it will be inside meshcore.js)

@mdshoaibumer
Copy link
Author

Dear @si458 ,

Kindly help us on this issue to close it down.

@ChristopheLac
Copy link

Dear @si458 ,

I have the same issue on multiple computer (W11):

server: Linux meshcentral-xxx 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
agent: W11 Pro 23H2, Ryzen 5, Ram 32Go.

If I can help ?

Christophe

@si458
Copy link
Collaborator

si458 commented Aug 26, 2024

@mdshoaibumer @ChristopheLac i keep trying to replicate this issue but cant replicate it on any of my machines!
its a once in a blue-moon bug! so annoying...
but will keep trying

@si458
Copy link
Collaborator

si458 commented Aug 26, 2024

@mdshoaibumer @ChristopheLac can you please share your config.json if possible?
the win-message-pump message shows in the above screenshot only appears when it trys to create WindowsConsole.TrayIcon
so im my eyes its a bug to do with icons/images?

@ChristopheLac
Copy link

ChristopheLac commented Aug 27, 2024

Hi @si458,

Thank for your help.

I did several successive tests and I noticed that the popup was not always the same. I put several screenshots showing the different states. In the 'config.json' file, I just changed the email address and password. If you need more information, or if I need to do some tests, let me know.
Kind regards

MeshCentral Version: v1.1.27
Node v18.19.1
Windows agent: Dec 9 2022, 3451659882

popup_1_meshcentral popup_2_meshcentral popup_3_meshcentral popup_4_meshcentral

config.json

@si458
Copy link
Collaborator

si458 commented Aug 27, 2024

@ChristopheLac ok so you are using translations from the looks of that screenshot,
so im guessing the remote machine uses non english? (french i believe?)
also can you try like @mdshoaibumer did above?
stop meshagent, then open admin command prompt cd to meshagent folder, then run meshagent.exe run
and watch its output, then when it crashes or hangs etc, see what it outpus says?

@ChristopheLac
Copy link

Hi @si458 ,

I stopped the service and launched "meshagent.exe run" as administrator. I have no problem (20 tries).
log:
C:\Program Files\Mesh Agent>meshagent.exe run
Connecting to: wss://192.168.22.251:4444/agent.ashx
2024-08-27 10:44:16 AM: Control Channel Idle Timeout = 120 seconds
Connected.
Server verified meshcore... Launching meshcore...

If I click on the disconnect button before the user authorizes it, I have the message below:
UncaughtException: Error: Error Resolving Promise: => EventEmitter.emit(): Event dispatch for 'resolved' on 'promise.internal' threw an exception: EventEmitter.emit(): Event dispatch for 'exit' on 'win-message-pump' threw an exception: EventEmitter.emit(): Event dispatch for 'rejected' on 'promise.internal' threw an exception: EventEmitter.emit(): Event dispatch for 'rejected' on 'promise.internal' threw an exception: TypeError: cannot read property 'remoteaddr' of null in method 'bound kvm_consentpromise_rejected()' in method 'bound _rejector()' in method 'pump_onExit()' in method 'bound ()'

If I launch "meshagent.exe run" as user, I have this message
"Unable to open database (1/10)...
Unable to open database (2/10)...
Unable to open database (3/10)... ",
which is normal I think.

For information, I am a 'simple' user on the computer, with UAC as in the image.
image

@si458
Copy link
Collaborator

si458 commented Aug 27, 2024

@ChristopheLac

"Unable to open database (1/10)... because means the is already another process of meshagent.exe running somewhere, you can only open its .db file one at a time

but weirdly enough you have the EXACT same message as @mdshoaibumer !?
which is good because it means it might be this causing it to crash!
and im guessing when its running as a service and crashing with this error,
windows is just killing the exe or app and restarting it,
hense why it then sometimes does then doesnt work

BUT
because you run the app manually meshagent.exe, it can error out to show you and carry on as normal, which is why it always works and you dont have the problem!

so we are making progress thank you!
i will try and have alook this week for you!

@si458 si458 self-assigned this Aug 27, 2024
@ChristopheLac
Copy link

ChristopheLac commented Aug 27, 2024

I can't run 'meshagent.exe run' as a user simply because I don't have permissions on the directory. If I change the permissions on the folder to modify and write permissions, I can run the application without errors.

C:\Program Files\Mesh Agent>meshagent.exe run
Connecting to: wss://192.168.22.251:4444/agent.ashx
2024-08-27 11:09:24 AM: Control Channel Idle Timeout = 120 seconds
Connected.
Server verified meshcore... Launching meshcore...

Thank to try to find the problem. I'll waiting your next message.

@si458
Copy link
Collaborator

si458 commented Aug 27, 2024

@ChristopheLac well weirdly enough i get kvm_consentpromise_rejected error here
so im just fixing that now incase its that causing the issue

si458 added a commit that referenced this issue Aug 27, 2024
Signed-off-by: si458 <simonsmith5521@gmail.com>
@si458
Copy link
Collaborator

si458 commented Aug 27, 2024

ok ive fixed the remoteaddr null error here e1e5995
but will need to keep trying to see if i can make it crash in the popup

@tobias9931
Copy link

In this context, would it be possible to implement that no user consent pop-up appears if no user is logged in and the consent is automatically approved?
See #6158
Just asking :)
Thanks

@ChristopheLac
Copy link

This is a very good development because it is a case that I regularly have in the management of the company's PCs.

I try the modification you do in the meshcore.js (commit f95dbdd), but no change for me.

Information that was sent to me by cyber surveillance, your tool is starting to be known by hackers who use it (like other teamviever, anydesk...). This is a good recognition of the quality of your development.

@si458
Copy link
Collaborator

si458 commented Aug 28, 2024

@tobias9931 baby steps, follow that issue for that progress and will look into it when I get chance

@ChristopheLac I think that's the wrong commit haha

@mdshoaibumer
Copy link
Author

Dear @si458 ,

May I know which websocket url to be allowed in AV in order to avoid blocking of POP ups in end user machine

@ChristopheLac
Copy link

@si458 : Yes, it's the previous commit (e1e5995) where the modification was made, but I had checked out the last commit of the master and taken the file from it.

@ChristopheLac
Copy link

Hi,
I try with the version 1.1.29, but no change ;)

@si458
Copy link
Collaborator

si458 commented Sep 10, 2024

@ChristopheLac I've still not been able to replicate the issue yet.
As dvery time I try it works fine
As I said previously I've only had it happen once on an old machine and even that machine can't replicate the issue not at all?

@ChristopheLac
Copy link

@si458 How I can help you ? You need to acces to my computer and meshcentral server ?

@si458
Copy link
Collaborator

si458 commented Sep 10, 2024

@ChristopheLac really both yes, email me if needs be (check my github page for email)

@si458
Copy link
Collaborator

si458 commented Sep 10, 2024

my notes:
if we disable the new dialog and revert to the old msgbox method, it works every time
but using the new consent dialog causes the issue?
uncomment line 3003 in meshcore.js
try { require('win-userconsent'); enhanced = true; } catch (ex) { }

@si458
Copy link
Collaborator

si458 commented Sep 10, 2024

so after some testing thank to @ChristopheLac,
not a number of displays issue, or resolution issue,
so its something to do with the new consent, so ill have to do more testing
as this now requires digging into the meshagent code itself!

si458 added a commit that referenced this issue Sep 10, 2024
…shing #6290

Signed-off-by: si458 <simonsmith5521@gmail.com>
@si458
Copy link
Collaborator

si458 commented Sep 10, 2024

ok have added in the option oldStyle into consentMessages as a workaround for the moment
this will be available in the latest development builds in about 15mins
ghcr.io/ylianst/meshcentral:master (Docker) OR npm install Ylianst/MeshCentral (remember no translations!)
image
image

@si458
Copy link
Collaborator

si458 commented Sep 10, 2024

if you are happy to debug something for me please can you try these steps and in the extact order!

  1. stop your meshagent from running as a service
  2. download psexec
  3. run cmd as admin
  4. run psexec.exe -i -s "c:\program files\MeshCentral\MeshAgent\meshagent.exe" run (your file path might be different)
  5. in the console tab of the device in the web ui run eval "console.setInfoLevel(1);"
  6. try connecting from the web ui with consent
  7. watch the black window that popped up in step 4 for all of its logs
  8. see what stage it sort of hangs or crashes or if the is a pattern

this is what im doing at the moment and indeed im getting it to crash about 25% of the time on my computer with 3 monitors!
but the machine is very very slow, was even able to get it to create 5 consent prompts for no reason haha
Desktop-QuadMonitor-2024-09-10-15-50(1)
Desktop-QuadMonitor-2024-09-10-15-49

@ChristopheLac
Copy link

I try many time. About near 10, I have only blank screen.

image

@si458
Copy link
Collaborator

si458 commented Sep 10, 2024

@ChristopheLac that's OK thank you! So ur seeing the same thing I am...
So I think the is an issue with Microsoft and the microcode between c++ and it's winapi?
Alot more investigating needed...

@si458
Copy link
Collaborator

si458 commented Sep 10, 2024

I try many time. About near 10, I have only blank screen.

@ChristopheLac
did you simply disconnect and reconnnect after like 5 seconds of the consent crashing then 10 times over try it?
or did it not appear at all then you disconnected and reconnected and try 10 times over?

@ChristopheLac
Copy link

@si458 : I disconnect and reconnnect after like 5 seconds
I try near 10 times, and the blank screen arrived. I try a new time (near 50), and it's work correctly.
I close psexec, execute the meshagent normaly (service), and at the 2nd time, the blank screen arrived.
I retry this morning with psexec, and after near 100 times, I have a bleu screen (not BSOD)
image

after near 30 seconds, the psexec exited:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants