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

DB Maintenance dialog missing #5110

Closed
gadolf66 opened this issue May 18, 2020 · 36 comments · Fixed by #5116
Closed

DB Maintenance dialog missing #5110

gadolf66 opened this issue May 18, 2020 · 36 comments · Fixed by #5116

Comments

@gadolf66
Copy link

Describe the bug
On close, darktable detects maintenance needed but does not show dialog, so it freezes (never closes, waiting for user input

To Reproduce
Force database maintenance needed, open darktable in debug mode and quit darktable.

Expected behavior
darktable minimizes but doesn't close, and debug session suggests it is waiting for user input.

Screenshots
2020-05-17_21-16

Platform (please complete the following information):

  • Darktable Version: 3.1.0~git1670.92a
  • OS: ubuntu 20.04
  • no
  • no

Additional context

@ptilopteri
Copy link

if you by chance have two monitors, see if the dialogue window is on the other display.

if so, consider closing this bug report.

@johnny-bit
Copy link
Member

This is weird... And it might be caused by some GTK weirdness that I personally don't like.

The dialog shows on whichever screen GTK considers "active", so if you had dt opened on one screen and some apps on another - then dialog will get shown on the other screen, not the one where dt was. If there were some apps in the foreground the dialog might be hidden behind them, especially if you switched to them (or WM switched to them) between the time main window was freed and other app captured focus, since dialog doesn't capture focus.

Additionally it's not really a dialog window in GTK sense so I wonder if setting it's position to either mouse or center would help a bit...

@ptilopteri
Copy link

@johnny-bit

Additionally it's not really a dialog window in GTK sense so I wonder if setting it's position to either mouse or center would help a bit...

I believe that would be what one would expect when utilizing more than one display. I constantly have negative comments when dialogues appear on a screen where the mouse/focus is not.

@gadolf66
Copy link
Author

if you by chance have two monitors, see if the dialogue window is on the other display.

No, I don't have.
I repeated the test just right now (no second monitor) and it happened again.

@ptilopteri
Copy link

is perhaps your screen display larger than your monitor?

@gadolf66
Copy link
Author

No, it isn't.
After opening DT:
2020-05-18_17-42

After closing dt
Screenshot from 2020-05-18 17-43-44
dt is still there, and in the debugging session it shows that it seems to be waiting for input (right?)
2020-05-18_17-46

@johnny-bit
Copy link
Member

Can you try #5116 if you are able to compile dt?

Another try might be to switch maintenance rule from "on close" to "on start" in options and see if that helps.

@gadolf66
Copy link
Author

gadolf66 commented May 18, 2020

Switched to on start, reopened it and nothing happened
At the moment I'm not able to compile it,
EDIT: I mean, same behaviour, cannot close it unless killing dt process

@johnny-bit
Copy link
Member

This is very very weird. This uses same code as for example "your database format is too old" so it should by all means create dialog window without any problem... Would need deeper look into it (or maybe switch dialog to native gtk dialogs?)

@parafin
Copy link
Member

parafin commented May 19, 2020

Maybe try not minimizing the window on exit? It's actually not the best way to close the application, replacing the contents of the window with some shutdown message would be nicer.

@gadolf66
Copy link
Author

gadolf66 commented May 20, 2020

Upgraded to darktable 3.1.0~git1711.33716cc60 but the issue remains unfortunately.
(Is it possible that the newly released Ubuntu 20.04 is contributing with something weird?)
Screenshot from 2020-05-20 19-53-51

I just can't find the confirmation window anywhere in the screen (I'm assuming that it's waiting for confirmation, right?):
Screenshot from 2020-05-20 19-56-33

@parafin
Copy link
Member

parafin commented May 21, 2020

Not responding message means that GTK main loop was stalled (exited?) by that point. I guess there's some bug in how exit is done in dt.

@parafin parafin reopened this May 21, 2020
@johnny-bit
Copy link
Member

This is veryvery weird. In #5124 I changed this to not minimize main window and show dialog on center on closing and my builds exit completelly normally, even with dialog opening (of course dialog keeps dt from being closed).

I need to do something to get #5124 integrated then and see if this helps - @gadolf66 can you please try code from #5124?

@johnny-bit
Copy link
Member

hmm... If you change maintenance to ask on start would closing error be still there?

@gadolf66
Copy link
Author

gadolf66 commented May 21, 2020

hmm... If you change maintenance to ask on start would closing error be still there?

I tried that before but it doesn't save it because the only way to quit dt is killing the process.
Is there any config file that I can manually tweak to enforce that setting?

@gadolf66
Copy link
Author

gadolf66 commented May 21, 2020

I need to do something to get #5124 integrated then and see if this helps - @gadolf66 can you please try code from #5124?

I can try it. Could you please customize the build steps below, I'm not good at it:

mkdir /home/gustavo/darktable
git clone https://github.com/darktable-org/darktable.git
cd darktable/
#git checkout negadoctor
git submodule init
git submodule update
./build.sh --prefix /opt/darktable --build-type Release
sudo cmake --build "/home/gustavo/darktable/build" --target install -- -j4 


@johnny-bit
Copy link
Member

weird. settings should get saved before you exit darktable. that's how I usually ride ;)

anyway - open file ~/.config/darktable/darktablerc in it find line starting with database/maintenance_check and change it to say database/maintenance_check=on start

@gadolf66
Copy link
Author

gadolf66 commented May 21, 2020

Thanks.
Now it hasn't freeze, but also hasn't done any maintenance (I guess).
There is an apparently infinite SELECT loop going on, so I'm not sure if the maintenance check hasn't been reached at that point in code.
But when it was set to on close the loop would stop and a log message showed that the maintenance check has been reached (see terminal images above)
Debugging session: https://filebin.net/4wdhotoo6sqqe2qj
EDIT: I have an inconsistency in the database image records in that they are tagged with tags I have deleted. Not sure if this could possibly add to the issue, but I suspect it explains the SELECT loop, because the last time I could quit normally (before it started to freeze) I was trying to filter by tags no longer existing.

@johnny-bit
Copy link
Member

johnny-bit commented May 21, 2020 via email

@gadolf66
Copy link
Author

gadolf66 commented May 21, 2020

Can you open db with sqlite3 and do PRAGMA integrity_check for both library. Db and data. Db?

Done, but same error.
I switched maintenance back to on close and the debugging session show the same message,
19,893201 [db maintenance] checking for maintenance, due to rule: 'on close'.
19,893358 [db maintenance] main: [993/2793 pages], data: [1/19 pages].
19,893376 [db maintenance] maintenance suggested, 32571392 bytes to free.

@gadolf66
Copy link
Author

gadolf66 commented May 21, 2020

I'm about to rebuild the 25k images database, since it's difficult to simulate this without my specifics (database & os)
I'll keep an eye and open a new issue if it happens again.
Thanks for your attention.

@johnny-bit
Copy link
Member

you can set db maintenance to "never" to not show dialog or use sqlite3 manually to do vacuum on both databases. the choice is yours... however I don't understand why the hell dialog won't open. it's the first such case :/

@gadolf66
Copy link
Author

you can set db maintenance to "never" to not show dialog or use sqlite3 manually to do vacuum on both databases.

Vacuum didn't do it.
maintenance to never also, but it shows this:

9,308852 [db maintenance] please consider enabling database maintenance.

I believe this means a pop up window should show up, right?

@johnny-bit
Copy link
Member

with 'never' popup will not be there at all.

@parafin
Copy link
Member

parafin commented May 22, 2020

It would help to have a backtrace when darktable hangs on exit. E.g. do "killall -SEGV darktable" at that point, it should write it to a file I think.

@gadolf66
Copy link
Author

gadolf66 commented May 22, 2020

It would help to have a backtrace when darktable hangs on exit. E.g. do "killall -SEGV darktable" at that point, it should write it to a file I think.

Here it is

dt.txt

@parafin
Copy link
Member

parafin commented May 22, 2020

Your darktable binary was built without debug symbols, so backtrace is missing a lot of information. Could you rebuild it, so debug symbols aren't stripped from the binary? Then generate backtrace again.

@johnny-bit
Copy link
Member

johnny-bit commented May 22, 2020

@gadolf66: change your build instructions to:

mkdir /home/gustavo/darktable
git clone https://github.com/darktable-org/darktable.git
cd darktable/
#git checkout negadoctor
git submodule init
git submodule update
./build.sh --prefix /opt/darktable --build-type RelWithDebInfo
sudo cmake --build "/home/gustavo/darktable/build" --target install -- -j4 

build type Release strips debugging symbols.

@gadolf66
Copy link
Author

Just for my understanding, these instructions are to get the current master, not your pr, right?

@johnny-bit
Copy link
Member

yep. my pr is currently not the focus here.

@gadolf66
Copy link
Author

I finished building and the test ran smoothly.
It closed normally (but didn't ask for any maintenance. Shouldn't it?)
Below is the debugging session, in case you want it.
dt.txt

@johnny-bit
Copy link
Member

johnny-bit commented May 22, 2020 via email

@gadolf66
Copy link
Author

No maintenance dialog, but it closed normally.
I guess the manual vacuum I did before per your suggestion cleaned the database, thus the absence of the dialog.
So I switched the fragmentation threshold to zero and voilá, it showed where the cursor was!
Now, I'm lost regarding which version should I use from now on.
Will this one that I build get to master? I'm updating from the opensuse repo.

@gadolf66
Copy link
Author

gadolf66 commented May 23, 2020

Maybe I wasn't clear enough in the previous post.but by manually building dt, the issue is gone.

But I'm lost as to which dt release is that, and if it is going to be in the opensuse repo.

I have an up-to-date opensuse master dt release that doesn't work, and this one that I manually built that does.
image

@gadolf66
Copy link
Author

gadolf66 commented May 23, 2020

Problem solved!
lua scripts Face Detection and photils are causing this behaviour.
If I comment out the scripts in lua.rc, the latest opensuse release works. (remember, I've set up database fragmentation ratio threshold to zero, so everytime I close dt it should pop up the confirmation dialgog)
Thanks all, and sorry if I misled the issue into the wrong direction.
Question: Should lua script issues be opened here as well?

@johnny-bit
Copy link
Member

I think rather on lua repo.

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 a pull request may close this issue.

4 participants