mmottl / postgresql-ocaml

OCaml-bindings for the PostgreSQL database
Other
141 stars 23 forks source link

Seg fault in example #18

Closed fxfactorial closed 8 years ago

fxfactorial commented 8 years ago

Thank you for this awesome work!

I am getting a seg fault on OS X for the prompt_gtk.ml example on OS X.

On OS X 10.11.3, ocaml version 4.02.3, postgresql 9.5.1 installed via brew.

I added #require "posgresql, lablgtk2" to the top and ran with

utop prompt_gtk.ml host=localhost

Then I get a seg fault

after these messages:

(process:18198): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(process:18198): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(process:18198): Gtk-WARNING **: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window

(process:18198): Gdk-CRITICAL **: gdk_pango_context_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed

(process:18198): Pango-CRITICAL **: pango_context_set_font_description: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_context_set_base_dir: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_context_set_language: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_new: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_set_text: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_set_alignment: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_set_ellipsize: assertion 'PANGO_IS_LAYOUT (layout)' failed

(process:18198): Pango-CRITICAL **: pango_layout_set_single_paragraph_mode: assertion 'PANGO_IS_LAYOUT (layout)' failed

(process:18198): Pango-CRITICAL **: pango_layout_set_width: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_get_extents: assertion 'layout != NULL' failed

(process:18198): Gdk-CRITICAL **: gdk_pango_context_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed

(process:18198): Pango-CRITICAL **: pango_context_set_font_description: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_context_set_base_dir: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_context_set_language: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_context_set_base_dir: assertion 'context != NULL' failed

(process:18198): Gdk-CRITICAL **: gdk_pango_context_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed

(process:18198): Pango-CRITICAL **: pango_context_set_font_description: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_context_set_base_dir: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_context_set_language: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_context_set_base_dir: assertion 'context != NULL' failed

(process:18198): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

(process:18198): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

(process:18198): Gtk-CRITICAL **: gtk_settings_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed

(process:18198): Gdk-CRITICAL **: gdk_screen_get_display: assertion 'GDK_IS_SCREEN (screen)' failed

(process:18198): GLib-GObject-CRITICAL **: g_object_get: assertion 'G_IS_OBJECT (object)' failed

(process:18198): Pango-CRITICAL **: pango_layout_new: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_set_alignment: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_set_spacing: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_set_indent: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_set_text: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_set_attributes: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_get_extents: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_get_width: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_get_cursor_pos: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_get_cursor_pos: assertion 'layout != NULL' failed

(process:18198): Gdk-CRITICAL **: gdk_pango_context_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed

(process:18198): Pango-CRITICAL **: pango_context_set_font_description: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_context_set_base_dir: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_context_set_language: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_context_set_base_dir: assertion 'context != NULL' failed

(process:18198): Gdk-CRITICAL **: gdk_pango_context_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed

(process:18198): Pango-CRITICAL **: pango_context_set_font_description: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_context_set_base_dir: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_context_set_language: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_context_set_base_dir: assertion 'context != NULL' failed

(process:18198): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

(process:18198): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

(process:18198): Gtk-CRITICAL **: gtk_settings_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed

(process:18198): Gdk-CRITICAL **: gdk_screen_get_display: assertion 'GDK_IS_SCREEN (screen)' failed

(process:18198): GLib-GObject-CRITICAL **: g_object_get: assertion 'G_IS_OBJECT (object)' failed

(process:18198): Pango-CRITICAL **: pango_layout_new: assertion 'context != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_set_alignment: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_set_spacing: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_set_indent: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_set_text: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_set_attributes: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_get_extents: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_get_width: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_get_cursor_pos: assertion 'layout != NULL' failed

(process:18198): Pango-CRITICAL **: pango_layout_get_cursor_pos: assertion 'layout != NULL' failed

(process:18198): Gdk-CRITICAL **: gdk_screen_get_default_colormap: assertion 'GDK_IS_SCREEN (screen)' failed

(process:18198): Gdk-CRITICAL **: gdk_colormap_get_visual: assertion 'GDK_IS_COLORMAP (colormap)' failed

(process:18198): Gdk-CRITICAL **: gdk_screen_get_default_colormap: assertion 'GDK_IS_SCREEN (screen)' failed

(process:18198): Gdk-CRITICAL **: gdk_screen_get_root_window: assertion 'GDK_IS_SCREEN (screen)' failed

(process:18198): Gdk-CRITICAL **: gdk_screen_get_root_window: assertion 'GDK_IS_SCREEN (screen)' failed

(process:18198): Gdk-CRITICAL **: gdk_window_new: assertion 'GDK_IS_WINDOW (parent)' failed

(process:18198): Gdk-CRITICAL **: gdk_window_set_user_data: assertion 'GDK_IS_WINDOW (window)' failed

(process:18198): Gtk-CRITICAL **: gtk_style_attach: assertion 'window != NULL' failed

(process:18198): Gtk-CRITICAL **: gtk_style_set_background: assertion 'GTK_IS_STYLE (style)' failed

(process:18198): Gtk-CRITICAL **: gtk_paint_flat_box: assertion 'GTK_IS_STYLE (style)' failed
[2]    18198 segmentation fault  utop prompt_gtk.ml host=localhost

Should I not be using lablgtk on OS X and instead be using the osx special gtk package?

Also, can you provide an example of what a connection string for these bindings out to look like? I tried using strings of form: postgresql://something...:some_port but it was rejected, something more meaty than just connecting to localhost would be greatly appreciated.

dbuenzli commented 8 years ago

Regarding gtk see https://github.com/mmottl/postgresql-ocaml/pull/17

mmottl commented 8 years ago

I'm afraid, but GTK does not seem to be particularly stable right now. There isn't much I can do about that.

What concerns connection strings, it really depends on the version of your server software whether it will interpret URIs. If your PostgreSQL server is >= 9.2 it will, otherwise only keyword bindings will do. See: http://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNSTRING

fxfactorial commented 8 years ago

@mmottl yes, I am on 9.4, hence assumed that postgresql://.... would work.

mmottl commented 8 years ago

@fxfactorial The OCaml bindings should pass on connection strings verbatim. I'm not sure what would happen if either the client library or server were outdated. I would assume, too, that URIs should otherwise work, but I cannot test this right now. Please let me know in case you find an issue with the bindings.