Forum: Ruby-Gnome 2 Headless running Segfault

Posted by "Chloé Desoutter" <chloe.desoutter@gmail.com> (Guest)
on 2011-12-19 16:32
(Received via mailing list)
Hi again,

I confirm that if I have started a X server from console and then export
DISPLAY=:0 and run the thing, it works.

Question is, why not otherwise?

:)

2011/12/19 Chlo Desoutter <chloe.desoutter@gmail.com>
Posted by Carlo E. Prelz (Guest)
on 2011-12-20 10:40
(Received via mailing list)
Subject: [ruby-gnome2-devel-en] Headless running Segfault
  Date: lun 19 dic 11 04:19:54 +0100

Quoting Chlo Desoutter (chloe.desoutter@gmail.com):

> That code, running on my headless (no X) server, is crashing
> pathetically:

It is because gtk2.rb includes a call to Gtk.init.

But if you comment out that call, your script crashes when you create
the pixmap:

Gdk-CRITICAL **:IA__gdk_screen_get_root_window: assertion `GDK_IS_SCREEN 
(screen)' failed
Gdk-CRITICAL **:IA__gdk_drawable_get_depth: assertion `GDK_IS_DRAWABLE 
(drawable)' failed

Apparently, the creation of a pixmap requires you to have a root
window.

Carlo

--
  *         Se la Strada e la sua Virtu' non fossero state messe da 
parte,
* K * Carlo E. Prelz - fluido@fluido.as             che bisogno ci 
sarebbe
  *               di parlare tanto di amore e di rettitudine? 
(Chuang-Tzu)
Posted by Grant Schoep (Guest)
on 2011-12-21 09:35
(Received via mailing list)
Can you just point yourself at another X server somewhere? A 
desktop/workstation?



From: Chlo Desoutter [mailto:chloe.desoutter@gmail.com]
Sent: Monday, December 19, 2011 8:20 AM
To: ruby-gnome2-devel-en@lists.sourceforge.net
Subject: [ruby-gnome2-devel-en] Headless running Segfault



Hi List,



That code, running on my headless (no X) server, is crashing 
pathetically:



chloe@ayodhya:~/pdfparser$ cat test.rb

begin

require 'gtk2'

rescue Gtk::InitError

end

require "poppler"



buf = Gdk::Pixbuf.new(Gdk::Pixbuf::COLORSPACE_RGB, true, 8, 1024, 768)



# copy the rendered buffer into an pixmap for further editing

map = Gdk::Pixmap.new(nil, 1024, 768, 24)

map.draw_pixbuf(nil, buf, 0, 0, 0, 0, -1, -1, Gdk::RGB::DITHER_NONE, 0, 
0)



Like that:

chloe@ayodhya:~/pdfparser$ ruby  test.rb

test.rb: line 10

   Gdk-CRITICAL **:IA__gdk_screen_get_root_window: assertion 
`GDK_IS_SCREEN (screen)' failed

test.rb: line 10

   Gdk-CRITICAL **:IA__gdk_drawable_get_depth: assertion 
`GDK_IS_DRAWABLE (drawable)' failed

Segmentation fault


I don't like much the idea of running an X server just for running that 
piece of software but feel like I'll have to.



Any insight?



Thanks

Chlo


This electronic communication and any attachments may contain 
confidential and proprietary
information of DigitalGlobe, Inc. If you are not the intended recipient, 
or an agent or employee
responsible for delivering this communication to the intended recipient, 
or if you have received
this communication in error, please do not print, copy, retransmit, 
disseminate or
otherwise use the information. Please indicate to the sender that you 
have received this
communication in error, and delete the copy you received. DigitalGlobe 
reserves the
right to monitor any electronic communication sent or received by its 
employees, agents
or representatives.
Posted by "Chloé Desoutter" <chloe.desoutter@gmail.com> (Guest)
on 2011-12-21 09:55
(Received via mailing list)
Hi,

Nope this is running in a production server that is intended to run
headless. I started a dumb X server on it, and it works but it's not the
best option.

2011/12/20 Grant Schoep <gschoep@digitalglobe.com>
Posted by Grant Schoep (Guest)
on 2011-12-21 10:08
(Received via mailing list)
Ah, I was thinking you would still run on that machine, but just set 
DISPLAY to a machine that has an Xserver.



From: Chlo Desoutter [mailto:chloe.desoutter@gmail.com]
Sent: Tuesday, December 20, 2011 8:52 AM
To: ruby-gnome2-devel-en@lists.sourceforge.net
Subject: Re: [ruby-gnome2-devel-en] Headless running Segfault



Hi,



Nope this is running in a production server that is intended to run 
headless. I started a dumb X server on it, and it works but it's not the 
best option.

2011/12/20 Grant Schoep <gschoep@digitalglobe.com>

Can you just point yourself at another X server somewhere? A 
desktop/workstation?



From: Chlo Desoutter [mailto:chloe.desoutter@gmail.com]
Sent: Monday, December 19, 2011 8:20 AM
To: ruby-gnome2-devel-en@lists.sourceforge.net


Subject: [ruby-gnome2-devel-en] Headless running Segfault



Hi List,



That code, running on my headless (no X) server, is crashing 
pathetically:



chloe@ayodhya:~/pdfparser$ cat test.rb

begin

require 'gtk2'

rescue Gtk::InitError

end

require "poppler"



buf = Gdk::Pixbuf.new(Gdk::Pixbuf::COLORSPACE_RGB, true, 8, 1024, 768)



# copy the rendered buffer into an pixmap for further editing

map = Gdk::Pixmap.new(nil, 1024, 768, 24)

map.draw_pixbuf(nil, buf, 0, 0, 0, 0, -1, -1, Gdk::RGB::DITHER_NONE, 0, 
0)



Like that:

chloe@ayodhya:~/pdfparser$ ruby  test.rb

test.rb: line 10

   Gdk-CRITICAL **:IA__gdk_screen_get_root_window: assertion 
`GDK_IS_SCREEN (screen)' failed

test.rb: line 10

   Gdk-CRITICAL **:IA__gdk_drawable_get_depth: assertion 
`GDK_IS_DRAWABLE (drawable)' failed

Segmentation fault


I don't like much the idea of running an X server just for running that 
piece of software but feel like I'll have to.



Any insight?



Thanks

Chlo

This electronic communication and any attachments may contain 
confidential and proprietary
information of DigitalGlobe, Inc. If you are not the intended recipient, 
or an agent or employee
responsible for delivering this communication to the intended recipient, 
or if you have received
this communication in error, please do not print, copy, retransmit, 
disseminate or
otherwise use the information. Please indicate to the sender that you 
have received this
communication in error, and delete the copy you received. DigitalGlobe 
reserves the
right to monitor any electronic communication sent or received by its 
employees, agents
or representatives.
Posted by Kouhei Sutou (Guest)
on 2011-12-23 08:32
(Received via mailing list)
Hi,

In <CAH9U35myVFycG0BO=if4T9ZP4PDfPtLysVmoTr-PvNb-cq3myQ@mail.gmail.com>
  "[ruby-gnome2-devel-en] Headless running Segfault" on Mon, 19 Dec 2011 
16:19:54 +0100,
  Chlo Desoutter <chloe.desoutter@gmail.com> wrote:

> map = Gdk::Pixmap.new(nil, 1024, 768, 24)
> map.draw_pixbuf(nil, buf, 0, 0, 0, 0, -1, -1, Gdk::RGB::DITHER_NONE, 0, 0)

Could you show your "further editing"?
You may not need GTK+. You may be able to do "further
editing" with cairo.


Thanks,
--
kou
Posted by "Chloé Desoutter" <chloe.desoutter@gmail.com> (Guest)
on 2011-12-23 08:49
(Received via mailing list)
Hi Kou, hi List

Basically I'm just saving the pixbuf as a JPEG or PNG file for 
integration
of it on a webpage.
Any clue how I could get that done headless? Never used Cairo directly, 
I'm
rather used to this pixmap/pixbuf save method.


Chlo


2011/12/22 Kouhei Sutou <kou@cozmixng.org>
Posted by Kouhei Sutou (Guest)
on 2011-12-23 09:54
(Received via mailing list)
Hi,

In <CAH9U35=yRyniKyPm0eMpGks38MSk_juRHKaxVDKSJoiwV6HoDw@mail.gmail.com>
  "Re: [ruby-gnome2-devel-en] Headless running Segfault" on Thu, 22 Dec 
2011 15:46:16 +0100,
  Chlo Desoutter <chloe.desoutter@gmail.com> wrote:

> Basically I'm just saving the pixbuf as a JPEG or PNG file for integration of
> it on a webpage.

Does it mean you want to convert a PDF to a JPEG or PNG? OK?

Here is a sample script for it:
  https://github.com/ruby-gnome2/ruby-gnome2/blob/ma...

> Any clue how I could get that done headless? Never used Cairo directly, I'm
> rather used to this pixmap/pixbuf save method.

You can use cairo and/or Pixbuf headless but you can't use
Pixmap headless.


Thanks,
--
kou
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.