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

Glibmm-error, detected trace/breakpoint #445

Closed
TeoColuccio opened this issue Apr 9, 2020 · 13 comments
Closed

Glibmm-error, detected trace/breakpoint #445

TeoColuccio opened this issue Apr 9, 2020 · 13 comments

Comments

@TeoColuccio
Copy link

Can't execute an ocr scan on pdf on Debian testing.
This is the error that appears while gimagereader is reading an pdf file:

(gimagereader-gtk:7526): glibmm-ERROR **: 22:01:38.056:
unhandled exception (type std::exception) in signal handler:
what: basic_string::assign: __pos (which is 18446744073709551615) > this->size() (which is 70)
Rilevato trace/breakpoint

@manisandro
Copy link
Owner

Can you run gImageReader through gdb and break on the exception being thrown? Like

$ gdb gimagereader-gtk
(gdb) run
# Prepare until action which causes exception, then ctrl+c to interrupt
(gdb) catch throw
(gdb) continue
 # Trigger exception
 (gdb) backtrace full

and then post the output? You'll also want to install the gimagereader-dbg package for debug symbols (I believe that's what it's called on Debian).

@TeoColuccio
Copy link
Author

Okk i'm attaching a file. I remain available if you need anything else..
gimage_error.txt

@manisandro
Copy link
Owner

manisandro commented Apr 12, 2020

Ah sorry, perhaps I wasn't sufficiently clear: you need to set catch throw right before the action which causes the exception, the log you attached has the exception go off before you set catch throw:

(gimagereader-gtk:12391): glibmm-ERROR **: 18:59:46.573: 
unhandled exception (type std::exception) in signal handler:
what: basic_string::assign: __pos (which is 18446744073709551615) > this->size() (which is 70)


Thread 1 "gimagereader-gt" received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff6834595 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) Quit
(gdb) catch throw  <<----- this is too late, exception already got thrown
Catchpoint 1 (throw)
(gdb) continue
Continuing.

@TeoColuccio
Copy link
Author

Ah sorry, maybe this is good:

Thread 1 "gimagereader-gt" hit Catchpoint 1 (exception thrown), 0x00007ffff5e5dbbe in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) backtrace full
#0 0x00007ffff5e5dbbe in __cxa_throw ()
from /lib/x86_64-linux-gnu/libstdc++.so.6
No symbol table info available.
#1 0x00007ffff5e55133 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
No symbol table info available.
#2 0x00007ffff73dcc8d in Glib::ustring::ustring(Glib::ustring const&, unsigned long, unsigned long) () from /lib/x86_64-linux-gnu/libglibmm-2.4.so.1
No symbol table info available.
#3 0x000055555563d3d0 in Utils::string_split_pos(Glib::ustring const&, Glib::RefPtrGlib::Regex const&) ()
No symbol table info available.
#4 0x0000555555640cb7 in HOCRDocument::checkSpelling(Glib::ustring const&, std::vector<Glib::ustring, std::allocatorGlib::ustring >, int) const ()
No symbol table info available.
#5 0x00005555556489b4 in HOCRDocument::checkItemSpelling(Gtk::TreeIter const&, std::vector<Glib::ustring, std::allocatorGlib::ustring >
, int) const ()
No symbol table info available.
#6 0x0000555555649285 in HOCRDocument::get_value_vfunc(Gtk::TreeIter const&, int, Glib::ValueBase&) const ()
No symbol table info available.
#7 0x00007ffff7a94b1e in Gtk::TreeModel_Class::get_value_vfunc_callback(_GtkTreeModel*, _GtkTreeIter*, int, _GValue*) ()
from /lib/x86_64-linux-gnu/libgtkmm-3.0.so.1
--Type for more, q to quit, c to continue without paging--
No symbol table info available.
#8 0x00007ffff6d19fe0 in ?? () from /lib/x86_64-linux-gnu/libgtk-3.so.0
No symbol table info available.
#9 0x00007ffff6779b40 in g_hash_table_foreach ()
from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#10 0x00007ffff6d19ebb in ?? () from /lib/x86_64-linux-gnu/libgtk-3.so.0
No symbol table info available.
#11 0x00007ffff6d1f70b in ?? () from /lib/x86_64-linux-gnu/libgtk-3.so.0
No symbol table info available.
#12 0x00007ffff6fb70d1 in ?? () from /lib/x86_64-linux-gnu/libgtk-3.so.0
No symbol table info available.
#13 0x00007ffff6876206 in ?? () from /lib/x86_64-linux-gnu/libgobject-2.0.so.0
No symbol table info available.
#14 0x00007ffff68948d4 in g_signal_emit_valist ()
from /lib/x86_64-linux-gnu/libgobject-2.0.so.0
No symbol table info available.
#15 0x00007ffff6894edf in g_signal_emit ()
from /lib/x86_64-linux-gnu/libgobject-2.0.so.0
No symbol table info available.
#16 0x00007ffff6d1b9a3 in gtk_cell_area_apply_attributes ()
from /lib/x86_64-linux-gnu/libgtk-3.so.0
No symbol table info available.
--Type for more, q to quit, c to continue without paging--
#17 0x00007ffff6f3db88 in ?? () from /lib/x86_64-linux-gnu/libgtk-3.so.0
No symbol table info available.
#18 0x00007ffff6f4573c in ?? () from /lib/x86_64-linux-gnu/libgtk-3.so.0
No symbol table info available.
#19 0x00007ffff6f45c2f in ?? () from /lib/x86_64-linux-gnu/libgtk-3.so.0
No symbol table info available.
#20 0x00007ffff6b0dd79 in ?? () from /lib/x86_64-linux-gnu/libgdk-3.so.0
No symbol table info available.
#21 0x00007ffff678b4de in g_main_context_dispatch ()
from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#22 0x00007ffff678b890 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#23 0x00007ffff678b91f in g_main_context_iteration ()
from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#24 0x00007ffff6e1cef1 in gtk_main_iteration_do ()
from /lib/x86_64-linux-gnu/libgtk-3.so.0
No symbol table info available.
#25 0x00007ffff7a4430d in Gtk::Main::iteration(bool) ()
from /lib/x86_64-linux-gnu/libgtkmm-3.0.so.1
No symbol table info available.
#26 0x000055555563b13c in Utils::busyTask(std::function<bool ()> const&, Glib::u--Type for more, q to quit, c to continue without paging--
string const&) ()
No symbol table info available.
#27 0x0000555555620c2e in Recognizer::recognize(std::vector<int, std::allocator > const&, bool) ()
No symbol table info available.
#28 0x0000555555621224 in Recognizer::recognizeMultiplePages() ()
No symbol table info available.
#29 0x00007ffff73db1e8 in Glib::SignalProxyNormal::slot0_void_callback(_GObject*, void*) () from /lib/x86_64-linux-gnu/libglibmm-2.4.so.1
No symbol table info available.
#30 0x00007ffff6875fd2 in g_closure_invoke ()
from /lib/x86_64-linux-gnu/libgobject-2.0.so.0
No symbol table info available.
#31 0x00007ffff68891b3 in ?? () from /lib/x86_64-linux-gnu/libgobject-2.0.so.0
No symbol table info available.
#32 0x00007ffff689454f in g_signal_emit_valist ()
from /lib/x86_64-linux-gnu/libgobject-2.0.so.0
No symbol table info available.
#33 0x00007ffff6894edf in g_signal_emit ()
from /lib/x86_64-linux-gnu/libgobject-2.0.so.0
No symbol table info available.
#34 0x00007ffff6f5ec7a in gtk_widget_activate ()
from /lib/x86_64-linux-gnu/libgtk-3.so.0
--Type for more, q to quit, c to continue without paging--
No symbol table info available.
#35 0x00007ffff6e30de6 in gtk_menu_shell_activate_item ()
from /lib/x86_64-linux-gnu/libgtk-3.so.0
No symbol table info available.
#36 0x00007ffff6e31073 in ?? () from /lib/x86_64-linux-gnu/libgtk-3.so.0
No symbol table info available.
#37 0x00007ffff7aa2b85 in Gtk::Widget::on_button_release_event(_GdkEventButton*) () from /lib/x86_64-linux-gnu/libgtkmm-3.0.so.1
No symbol table info available.
#38 0x00007ffff7aa4bb5 in Gtk::Widget_Class::button_release_event_callback(_GtkWidget*, _GdkEventButton*) () from /lib/x86_64-linux-gnu/libgtkmm-3.0.so.1
No symbol table info available.
#39 0x00007ffff6fb016b in ?? () from /lib/x86_64-linux-gnu/libgtk-3.so.0
No symbol table info available.
#40 0x00007ffff6876206 in ?? () from /lib/x86_64-linux-gnu/libgobject-2.0.so.0
No symbol table info available.
#41 0x00007ffff6893c51 in g_signal_emit_valist ()
from /lib/x86_64-linux-gnu/libgobject-2.0.so.0
No symbol table info available.
#42 0x00007ffff6894edf in g_signal_emit ()
from /lib/x86_64-linux-gnu/libgobject-2.0.so.0
No symbol table info available.
#43 0x00007ffff6f5be92 in ?? () from /lib/x86_64-linux-gnu/libgtk-3.so.0
--Type for more, q to quit, c to continue without paging--
No symbol table info available.
#44 0x00007ffff6e1bc18 in ?? () from /lib/x86_64-linux-gnu/libgtk-3.so.0
No symbol table info available.
#45 0x00007ffff6e1dddb in gtk_main_do_event ()
from /lib/x86_64-linux-gnu/libgtk-3.so.0
No symbol table info available.
#46 0x00007ffff6b19815 in ?? () from /lib/x86_64-linux-gnu/libgdk-3.so.0
No symbol table info available.
#47 0x00007ffff6b4ba62 in ?? () from /lib/x86_64-linux-gnu/libgdk-3.so.0
No symbol table info available.
#48 0x00007ffff678b60d in g_main_context_dispatch ()
from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#49 0x00007ffff678b890 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#50 0x00007ffff678b91f in g_main_context_iteration ()
from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#51 0x00007ffff69d2f9d in g_application_run ()
from /lib/x86_64-linux-gnu/libgio-2.0.so.0
No symbol table info available.
#52 0x00005555555bfe3d in main ()
No symbol table info available.

@manisandro
Copy link
Owner

Yep that's more interesting. Can you share anything with which this can be reproduced?

@TeoColuccio
Copy link
Author

TeoColuccio commented Apr 20, 2020

I don't know precisely, I'm simply scanning an pdf of 338 pages and gimage crashes at about 250.
I remain available

@manisandro
Copy link
Owner

I'd need to know the value of the first argument to HOCRDocument::checkSpelling here:

#4 0x0000555555640cb7 in HOCRDocument::checkSpelling(Glib::ustring const&, std::vector<Glib::ustring, std::allocatorGlib::ustring >, int) const ()

Are you comfortable compiling stuff? Otherwise, is this PDF your recognizing a document you can share?

@TeoColuccio
Copy link
Author

I'm very sorry, but the document is not owned by me, so I can't share it .. but I'm available to compiling

@manisandro
Copy link
Owner

No problem, applying the following

diff --git a/gtk/src/hocr/HOCRDocument.cc b/gtk/src/hocr/HOCRDocument.cc
index f26e546..73e11f4 100644
--- a/gtk/src/hocr/HOCRDocument.cc
+++ b/gtk/src/hocr/HOCRDocument.cc
@@ -647,6 +647,7 @@ Glib::RefPtr<Gdk::Pixbuf> HOCRDocument::decorationRoleForItem(const HOCRItem* it
}

bool HOCRDocument::checkSpelling(const Glib::ustring& trimmed, std::vector<Glib::ustring>* suggestions, int limit) const {
+       std::cout << ">" << trimmed << "<" << std::endl;
        static const Glib::RefPtr<Glib::Regex> splitRe = Glib::Regex::create("[\u2013\u2014]+");
        std::vector<std::pair<Glib::ustring, int>> words = Utils::string_split_pos(trimmed, splitRe);

to the current git master and building (passing -DINTERFACE_TYPE=gtk to cmake to build the GTK interface), the last word printed on the terminal before gImageReader crashes should be the one causing the exception - that's the value I'm after to reproduce this.

@TeoColuccio
Copy link
Author

Ok this is the last output:

(gimagereader-gtk:5604): GdkPixbuf-CRITICAL **: 10:23:15.123: gdk_pixbuf_calculate_rowstride: assertion 'width > 0' failed
Il<
ciclo<
di<
vita-diuncursore-ècaratterizzato<
dalle<
seguenti-fasit—T————————__—_<
(gimagereader-gtk:5604): glibmm-ERROR **: 10:23:15.127:
unhandled exception (type std::exception) in signal handler:
what: basic_string::assign: __pos (which is 18446744073709551615) > this->size() (which is 70)
Rilevato trace/breakpoint

ps I can confirm that on debian stable, this pdf is correctly scannable. So it's a problem with debian testing

@manisandro
Copy link
Owner

Thanks, I can reproduce this purely with the glibmm string manipulation functions, looking into it.

@TeoColuccio
Copy link
Author

Well, I'll be available if you need to do other tests.

@manisandro
Copy link
Owner

manisandro commented Apr 22, 2020

Should be fixed with 6ead57d, thanks for reporting!

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

2 participants