Headless running Segfault

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?

:slight_smile:

2011/12/19 Chlo D. [email protected]

Subject: [ruby-gnome2-devel-en] Headless running Segfault
Date: lun 19 dic 11 04:19:54 +0100

Quoting Chlo D. ([email protected]):

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: assertionGDK_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 - [email protected] che bisogno ci
    sarebbe
    •           di parlare tanto di amore e di rettitudine? 
      

(Chuang-Tzu)

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

From: Chlo D. [mailto:[email protected]]
Sent: Monday, December 19, 2011 8:20 AM
To: [email protected]
Subject: [ruby-gnome2-devel-en] Headless running Segfault

Hi List,

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

[email protected]yodhya:~/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:

[email protected]:~/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.

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 S. [email protected]

Ah, I was thinking you would still run on that machine, but just set
DISPLAY to a machine that has an Xserver.

From: Chlo D. [mailto:[email protected]]
Sent: Tuesday, December 20, 2011 8:52 AM
To: [email protected]
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 S. [email protected]

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

From: Chlo D. [mailto:[email protected]]
Sent: Monday, December 19, 2011 8:20 AM
To: [email protected]

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

Hi List,

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

[email protected]:~/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:

[email protected]:~/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.

Hi,

In [email protected]
“[ruby-gnome2-devel-en] Headless running Segfault” on Mon, 19 Dec 2011
16:19:54 +0100,
Chlo D. [email protected] 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

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 S. [email protected]

Hi,

In [email protected]
“Re: [ruby-gnome2-devel-en] Headless running Segfault” on Thu, 22 Dec
2011 15:46:16 +0100,
Chlo D. [email protected] 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/master/poppler/sample/pdf2.rb

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs