Skip to content
This repository has been archived by the owner on Aug 31, 2020. It is now read-only.

Antimicro crashes when XBox 360 controller turns off automatically #64

Open
maxigaz opened this issue Mar 29, 2019 · 26 comments
Open

Antimicro crashes when XBox 360 controller turns off automatically #64

maxigaz opened this issue Mar 29, 2019 · 26 comments
Labels
bug Something isn't working

Comments

@maxigaz
Copy link

maxigaz commented Mar 29, 2019

Whenever my wireless XBox 360 controller switches off automatically after 15 minutes of being idle, Antimicro crashes.

From time to time, it also happens when I manually disconnect my DualShock 4 via Bluetooth, although I don't know how to reproduce it reliably.

  • Operating System: Manjaro Linux KDE
  • Antimicro Version: 2.24*
  • Qt Version: 5.12.1
  • Kernel Version: 4.19.30-1-MANJARO x86_64

*According to antimicro -v, the version number is 2.24. However, the AUR package info says it's 2.24.1.

@juliagoda
Copy link
Owner

Thanks, I will take a look at it

@maxigaz
Copy link
Author

maxigaz commented Apr 8, 2019

After further testing, I think it has more to do with autoprofiles rather than the automatic switching off of the gamepad.

I've just tried the following with both the Xbox 360 controller and DualShock 4 multiple times, and the results are the same:

  1. Launch Antimicro and connect the gamepad.
  2. Open an application associated with an autoprofile (in my case, mpv) and close it.
  3. Disconnect the gamepad.
  4. Antimicro crashes.

@juliagoda
Copy link
Owner

Thank you, any help I can get is useful. I'll check it all out after defending my thesis.

@juliagoda juliagoda added the bug Something isn't working label Apr 18, 2019
@juliagoda
Copy link
Owner

Could you check if this is still present in the last commit from the test branch?

git clone -b testing https://github.com/juliagoda/antimicro.git
cd antimicro
mkdir compile
cd compile
cmake ..
make
sudo make install

@maxigaz
Copy link
Author

maxigaz commented Apr 24, 2019

After some testing, I couldn't reproduce the crash with neither gamepad with the steps I wrote in the reply above.

Although I'm already very pleased, I'll see if the originally supposed issue (with the automatic turn off of the XBox controller) is still present tomorrow for good measure.

@juliagoda
Copy link
Owner

ok thanks

@maxigaz
Copy link
Author

maxigaz commented Apr 25, 2019

It's still working fine. Thank you so much!

@maxigaz maxigaz closed this as completed Apr 25, 2019
@maxigaz
Copy link
Author

maxigaz commented Apr 25, 2019

Sorry, I'm afraid I'll have to take back what I said in my last reply. Antimicro still crashes when the XBox 360 controller turns off automatically. I'm not sure why it didn't happen earlier today.

However, when I switch it off manually (by removing the batteries), there are no crashes anymore at least.

@maxigaz maxigaz reopened this Apr 25, 2019
@maxigaz
Copy link
Author

maxigaz commented Apr 26, 2019

OK, I think I know what was different last time. Antimicro crashed when ~/.config/antimicro was completely new. However, with the old config file, I couldn't make it crash.

I investigated further and found the following in the new config file:

[General]
AutoOpenLastProfile=1

I noticed that in the old one, the value of AutoOpenLastProfile is 0. So I changed it to 0 in the new one as well. It hasn't crashed since then.

@juliagoda
Copy link
Owner

Thanks for seeing it. You're very perceptive. Besides, I looked on the Internet and noticed that these controllers often turn off after about 15 minutes and in many situations and in some places it causes troublesome problems. So I can still think of a function that would detect a longer period of inactivity and cause motion one degree on any axis, e.g. after 5 minutes or 10 minutes. Perhaps it might even be a good idea to create such an additional option in the settings, where the user would set the frequency himself.

@juliagoda
Copy link
Owner

juliagoda commented Apr 26, 2019

run in terminal:
ulimit -c unlimited
an then
antimicro

then try to cause this problem again, then copy the last few lines of the result and paste here. Save the whole result temporarily to a file just in case

@maxigaz
Copy link
Author

maxigaz commented Apr 27, 2019

Save the whole result temporarily to a file just in case

Do you mean save the output to a log file? How can I do that?

@juliagoda
Copy link
Owner

try:
antimicro &> log.txt

It should write what is happening in the program to the log.txt file. Of course you can name the "log.txt" file differently. Don't forget to call "ulimit -c unlimited" first in the same terminal session.

@maxigaz
Copy link
Author

maxigaz commented Apr 27, 2019

Well, I copied the last ~600 lines of the output manually and posted them here. (I can save the whole input using antimicro &> log.txt next time if you want.)

Out of all that, here are the last 28 lines:

Debug: Raw value is less than  32767  and greather than  -32767 ((null):0, (null))
Debug: Raw value for axis is:  0 ((null):0, (null))
Debug: Throtted value at start of function is:  0 ((null):0, (null))
Debug: Calculated value of throttle is:  0 ((null):0, (null))
Debug: Throtted value at start of function is:  0 ((null):0, (null))
Debug: Calculated value of throttle is:  0 ((null):0, (null))
Debug: Raw value is less than  32767  and greather than  -32767 ((null):0, (null))
Debug: Raw value for axis is:  0 ((null):0, (null))
Debug: Throtted value at start of function is:  0 ((null):0, (null))
Debug: Calculated value of throttle is:  0 ((null):0, (null))
Debug: Throtted value at start of function is:  0 ((null):0, (null))
Debug: Calculated value of throttle is:  0 ((null):0, (null))
Debug: Raw value is less than  32767  and greather than  -32767 ((null):0, (null))
Debug: Raw value for axis is:  0 ((null):0, (null))
Debug: Throtted value at start of function is:  0 ((null):0, (null))
Debug: Calculated value of throttle is:  0 ((null):0, (null))
Warning: QSocketNotifier: Invalid socket 6 and type 'Read', disabling... ((null):0, (null))
Warning: QSocketNotifier: Invalid socket 11 and type 'Read', disabling... ((null):0, (null))
Warning: QSocketNotifier: Invalid socket 10 and type 'Read', disabling... ((null):0, (null))
Warning: QSocketNotifier: Invalid socket 8 and type 'Read', disabling... ((null):0, (null))
Warning: QSocketNotifier: Invalid socket 18 and type 'Read', disabling... ((null):0, (null))
Warning: QSocketNotifier: Invalid socket 9 and type 'Read', disabling... ((null):0, (null))
Debug: "/usr/bin/antimicro" ((null):0, (null))
Warning: The X11 connection broke: I/O error (code 1) ((null):0, (null))
XIO:  fatal IO error 9 (Hibás fájlleíró) on X server ":0"
      after 101251 requests (101251 known processed) with 6 events remaining.
Warning: QObject::killTimer: Timers cannot be stopped from another thread ((null):0, (null))
Warning: QObject::~QObject: Timers cannot be stopped from another thread ((null):0, (null))

juliagoda pushed a commit that referenced this issue Apr 29, 2019
@juliagoda
Copy link
Owner

juliagoda commented Apr 29, 2019

Could you build it again from test branch and copy lines of code again? This time last 60 lines? It's hard to easily find the problem without such controller

juliagoda pushed a commit that referenced this issue Apr 29, 2019
@maxigaz
Copy link
Author

maxigaz commented Apr 30, 2019

I've recently recompiled the latest and left it running with the gamepad being idle for over 15 minutes (and AutoOpenLastProfile set to 1). When I came back, although the gamepad switched off, antimicro didn't crash. I also couldn't find any warnings or error messages in the terminal output this time.

So, I guess you managed to fix it. :) I'll let you know if I can reproduce the issue again and paste the output. In the meantime, thanks a lot! I appreciate your work.

@juliagoda
Copy link
Owner

Since when has this error occurred? After solving #69? Does the problem appear in other applications too (Is it possible to check this out?)?

@maxigaz
Copy link
Author

maxigaz commented Nov 8, 2019

Since when has this error occurred? After solving #69?

Yes, when I saw your question there, I cloned the master branch, compiled and tested it. Before that, I’d been using Antimicro v2.24.2 (installed from the AUR).

Does the problem appear in other applications too (Is it possible to check this out?)?

Do you mean whether other applications crash when I disconnect a gamepad? No, I haven’t noticed anything like that outside Antimicro.

@juliagoda
Copy link
Owner

I'll create a condition for wireless gamepads in #74 and we will see if it works.

@maxigaz
Copy link
Author

maxigaz commented Nov 9, 2019

@juliagoda I'm just letting you know that I can't reliably reproduce the issue anymore.

To recap the steps:

  1. Make sure AutoOpenLastProfile has the value 1 in ~/.config/antimicro.
  2. Launch Antimicro and connect the gamepad.
  3. Open an application associated with an autoprofile (in my case, mpv) and close it.
  4. Disconnect the gamepad.

By doing this, I could make Antimicro crash again three days ago more than one time in a row. Yesterday it crashed once with the Xbox gamepad. Now (still on the same version), it doesn’t crash anymore with neither gamepads.

Edit: The issue is back. I don't know what happened. Sorry about the confusion.

@juliagoda
Copy link
Owner

juliagoda commented Nov 11, 2019

Because the problem may be somewhere else in the code of some library, maybe X11. SDL_JoystickCurrentPowerLevel once shows the result -1, which is SDL_JOYSTICK_POWER_UNKNOWN, and once SDL_JOYSTICK_POWER_WIRED, which is how it should be in my case. It happened in the same place. I changed the code, as I said, but so far it works the way the SDL library wants it to. SDL_GetError does not show any text when -1 occurs, as if there was no problem. There is currently no alternative to SDL_JoystickCurrentPowerLevel, so we have to wait until someone improves this feature. This is quite likely, as there have been various problems with this feature. Maybe I'll come up with another idea.

@juliagoda
Copy link
Owner

juliagoda commented Jun 5, 2020

And I came up with another idea. I noticed that when the gamecontrollers were disconnected while such windows like calibration were open, the application crashed. I fixed this kind of bug, so maybe now it will work and maybe that was the reason why it worked sometimes and sometimes not.

@maxigaz
Copy link
Author

maxigaz commented Jun 5, 2020

Was it recently that you pushed the fix? I’ve had AntimicroX from the AUR package antimicrox-git installed since 18 Apr 2020. The application still crashes when I leave the XBox controller untouched for over 15 minutes.

Or if you pushed it after 18 Apr 2020, let me know and I’ll recompile it and see if it works.

@juliagoda
Copy link
Owner

Yes, I pushed it after the date. I've found #107 #108 and #109 bugs

@maxigaz
Copy link
Author

maxigaz commented Jun 6, 2020

I’ve just reinstalled and tested it. It still crashes. (Unlike the issues you linked, I have no windows of AntimicroX open when that happens, by the way.)

@juliagoda
Copy link
Owner

Ok then

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants