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

/usr/bin/sugar does not exit if window is closed #952

Open
quozl opened this issue Jan 25, 2022 · 21 comments
Open

/usr/bin/sugar does not exit if window is closed #952

quozl opened this issue Jan 25, 2022 · 21 comments

Comments

@quozl
Copy link
Contributor

quozl commented Jan 25, 2022

Running /usr/bin/sugar from a GNOME Terminal under X11 is not something we had planned, but if it is done and the window is closed, Sugar does not exit.

@sarthak0527
Copy link

I would like to work on this issue.

@chimosky
Copy link
Member

@sarthak0527 feel free to open a PR when you have one.

@sarthak0527
Copy link

I'm new to open source , could you guide me how can I solve this issue ?

@quozl
Copy link
Contributor Author

quozl commented Apr 1, 2022

Not really, if we knew how to solve the issue we would just go ahead and do so.

@chimosky
Copy link
Member

chimosky commented Apr 1, 2022

@sarthak0527 a great place to start would be reproducing the issue, you'll have to run it from GNOME though.
You'll need to have sugar installed before you run the command above in your terminal.

@sarthak0527
Copy link

sarthak0527 commented Apr 2, 2022

@chimosky I have installed the sugar . Now what should I do next?

@quozl
Copy link
Contributor Author

quozl commented Apr 2, 2022

The issue is;

Running /usr/bin/sugar from a GNOME Terminal is not something we had planned, but if it is done and the window is closed, Sugar does not exit.

Have you run GNOME Terminal?

When GNOME Terminal is running, have you run /usr/bin/sugar?

When the Sugar window is closed, what do you observe about the Sugar process?

@sarthak0527
Copy link

sarthak0527 commented Apr 3, 2022

I did run GNOME Terminal.

After running /usr/bin/sugar , it is running but in system monitor it is not showing .

Also when the sugar window is closed ,I oberserve nothing about the process.

@quozl
Copy link
Contributor Author

quozl commented Apr 3, 2022

System monitor does not show all processes. The shell command sudo ps ax may be helpful for listing all processes.

When you say you observe nothing about the process, what do you mean? Does the process exit, or is it still running as described in this issue? You have to be familiar with Linux process creation and termination to be able to detect this issue.

@solo-daemon
Copy link

@quozl i would like to work on this

@quozl
Copy link
Contributor Author

quozl commented Jan 18, 2023

My commiserations to you. Good luck!

@DaffyTheDuck
Copy link

DaffyTheDuck commented Feb 2, 2023

Hi there! May I know what was the expected output ?

@quozl
Copy link
Contributor Author

quozl commented Feb 2, 2023

/usr/bin/sugar is a shell script derived from bin/sugar.in, and generates quite a lot of output in various places. The output it generates is not the concern in this issue, it is that the processes run by the shell script do not terminate when an enclosing GNOME Terminal is closed.

@DaffyTheDuck
Copy link

/usr/bin/sugar is a shell script derived from bin/sugar.in, and generates quite a lot of output in various places. The output it generates is not the concern in this issue, it is that the processes run by the shell script do not terminate when an enclosing GNOME Terminal is closed.

Hmm! as I ran this command in my terminal, I noticed that it changed my cursor style and replaced it with the one in sugar environment, also in the output of ps ax I see no process of sugar running. Also it keeps the cursor in the same way even the terminal is closed! as i've little experience in linux and it's processes, i would love it if you enlighten me more on this 😄

@quozl
Copy link
Contributor Author

quozl commented Feb 2, 2023

Yes, that's right.

Sugar was never intended to be run from any terminal, but rather as an X windows session manager, or the .xsession file. Sugar does work properly when run in that way.

All logs are kept in .sugar/default/logs and that's where you can look for an explanation of why Sugar terminated early.

Changing cursor is one of the steps of Sugar startup (src/jarab/main.py search for cursor-theme), and there is code to put it back the way it was if Sugar is exited normally.

So given your description I'd say Sugar failed to start, and the explanation will be in the logs. That isn't what happened in this issue though.

@bhavyabansal9068
Copy link

bhavyabansal9068 commented Mar 24, 2023

@chimosky @quozl
Hello team,

Please guide me based on my analysis on this issue.
I have investigated the issue and have come to the conclusion that the problem lies in the sugar/src/jarabe/main.py file. Specifically, the "_start_window_manager()" function is being called internally and is changing the cursor of the virtual machine without performing verification.

image

This is why no processes appear to be running even after closing the GNOME terminal but cursor is changed. Upon reviewing the logs, I also noticed that when we trigger Sugar from GNOME terminal, it fails because screen 0 is already in use. However, the root cause of this issue is the cursor change in the code.

image

To resolve this issue, we could change the cursor only after verifying whether our screen is already in use or not. To further improve these kinds of issue we could use proper error handling (Try and Except Block). I would be happy to contribute more to Sugarlabs.

Best regards, Bhavya Bansal

@quozl
Copy link
Contributor Author

quozl commented Mar 25, 2023

G'day, and thanks for your input. The problem described is that the process does not exit. The process does continue running. If you think that changing the cursor theme has anything to do with it, then please do test and let us know your result, either here or as a pull request. As for me, I don't see how the cursor theme can cause a process not to exit. I was puzzled as to why you brought it up, then I remembered someone mentioned it. Don't be distracted by comments unrelated to the issue.

Please, in future copy and paste messages or code into the issue rather than use screenshots; your screenshots are (a) not read by a screenreader, (b) not searchable, (c) not visible when reading mail using mutt or high security mail readers. See Creating and highlighting code blocks.

I've checked the mailing list pending administrative actions and there are none. I've checked and your mail address [email protected] is not subscribed. Please do subscribe.

@bhavyabansal9068
Copy link

bhavyabansal9068 commented Mar 25, 2023

Thanks for guiding @quozl . I have attached the error logs that we are getting after running Sugar from the GNOME terminal.

(main.py:3327): Wnck-WARNING **: 08:54:39.331: libwnck is designed to work in X11 only, no valid display found

(metacity:3334): metacity-WARNING **: 08:54:39.359: Option “--no-composite” is deprecated, use the “--compositor” instead.
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3/dist-packages/jarabe/main.py", line 380, in <module>
    main()
  File "/usr/lib/python3/dist-packages/jarabe/main.py", line 347, in main
    _start_window_manager()
  File "/usr/lib/python3/dist-packages/jarabe/main.py", line 208, in _start_window_manager
    screen.connect('window-manager-changed', __window_manager_changed_cb)
AttributeError: 'NoneType' object has no attribute 'connect'

(metacity:3334): metacity-WARNING **: 08:54:40.261: Screen 0 on display ":0" already has a window manager; try using the --replace option to replace the current window manager.

So, what I am thinking is, if we could add a validation check at the beginning of our main code to determine whether the screen is a window manager or not, it might help. Right? This way, before executing any process or job, our code will stop its execution."

@quozl
Copy link
Contributor Author

quozl commented Mar 25, 2023

That's a problem, but it's not this issue. I don't want to talk about it here in this issue. Please take it to another issue or better yet make a pull request to fix it.

@bhavyabansal9068
Copy link

@quozl Raised PR, Please Review.

@quozl
Copy link
Contributor Author

quozl commented Mar 31, 2023

As a data point, the Logout option does terminate the Sugar process on 0.118 on Debian 11 Bullseye.

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

No branches or pull requests

6 participants