Coder Social home page Coder Social logo

Comments (6)

Nakilon avatar Nakilon commented on May 10, 2024

Existing similar issues are all about some memory leaks: https://github.com/jcupitt/ruby-vips/search?q=0x0000000000000000&type=Issues

Here is my macOS environment:

$ bundle exec gem list
...
ffi (1.9.23)
...
ruby-vips (2.0.12)
$ vips -v
vips-8.6.3-Thu Mar  8 15:18:35 UTC 2018

and I never had this error.

Maybe @jcupitt can tell how to debug it.

from dhash-vips.

jcupitt avatar jcupitt commented on May 10, 2024

I tried with git master libvips and with 8.4.6 and they both worked fine. I guess we are all using the same ffi and ruby-vips, so perhaps the difference is the Ruby version?

I'm 2.5.1p57, if that helps.

from dhash-vips.

kochd avatar kochd commented on May 10, 2024

Strace:
strace.log

Version:
ffi (1.9.23)
ruby-vips (2.0.12)
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]

Memoryleak is not an option. I get this error instantly,

$ ruby -r 'dhash-vips' -e 'DHashVips::DHash.calculate("00001.jpg")'
vips warning: tilecache: error in tile 0 x 0
Traceback (most recent call last):
	4: from -e:1:in `'
	3: from /var/lib/gems/2.5.0/gems/dhash-vips-0.0.6.0/lib/dhash-vips.rb:24:in `calculate'
	2: from /var/lib/gems/2.5.0/gems/ruby-vips-2.0.12/lib/vips/image.rb:951:in `to_a'
	1: from /var/lib/gems/2.5.0/gems/ruby-vips-2.0.12/lib/vips/image.rb:478:in `write_to_memory'
/var/lib/gems/2.5.0/gems/ruby-vips-2.0.12/lib/vips/image.rb:478:in `get_bytes': invalid memory read at address=0x0000000000000000 (FFI::NullPointerError)

from dhash-vips.

jcupitt avatar jcupitt commented on May 10, 2024

Huh how weird!

ruby-vips has some logging stuff, could you try enabling that and post the output? I see:

john@kiwi:~/pics$ irb
irb(main):001:0> require 'logger'
=> true
irb(main):002:0> require 'vips'
=> true
irb(main):003:0> GLib::logger.level = Logger::DEBUG
=> 0
irb(main):004:0> require 'dhash-vips'
=> true
irb(main):005:0> DHashVips::DHash.calculate "k2.jpg"
D, [2018-05-12T12:09:45.626653 #18885] DEBUG -- Vips::VipsOperation.call: name = VipsForeignLoadJpegFile, supplied = ["k2.jpg"], optional = {}, option_string = 
D, [2018-05-12T12:09:45.630126 #18885] DEBUG -- Vips::Object.set: filename = k2.jpg
D, [2018-05-12T12:09:45.630687 #18885] DEBUG -- Vips::Object.get: out == #<Vips::Image:0x0000563baaf485f8>
D, [2018-05-12T12:09:45.630737 #18885] DEBUG -- Vips::Operation.call: result = #<Vips::Image:0x0000563baaf485f8>
D, [2018-05-12T12:09:45.631261 #18885] DEBUG -- Vips::VipsOperation.call: name = resize, supplied = [#<Image 1450x2048 uchar, 3 bands, srgb>, 0.006206896551724138], optional = {:vscale=>0.00390625}, option_string = 
D, [2018-05-12T12:09:45.631449 #18885] DEBUG -- Vips::Object.set: in = #<Vips::Image:0x0000563baaf485f8>
D, [2018-05-12T12:09:45.631581 #18885] DEBUG -- Vips::Object.set: scale = 0.006206896551724138
D, [2018-05-12T12:09:45.631656 #18885] DEBUG -- Vips::Object.set: vscale = 0.00390625
D, [2018-05-12T12:09:45.634616 #18885] DEBUG -- Vips::Object.get: out == #<Vips::Image:0x0000563baaf42040>
D, [2018-05-12T12:09:45.634716 #18885] DEBUG -- Vips::Operation.call: result = #<Vips::Image:0x0000563baaf42040>
D, [2018-05-12T12:09:45.635359 #18885] DEBUG -- Vips::VipsOperation.call: name = colourspace, supplied = [#<Image 9x8 uchar, 3 bands, srgb>, "b-w"], optional = {}, option_string = 
D, [2018-05-12T12:09:45.635619 #18885] DEBUG -- Vips::Object.set: in = #<Vips::Image:0x0000563baaf42040>
D, [2018-05-12T12:09:45.635825 #18885] DEBUG -- Vips::Object.set: space = b-w
D, [2018-05-12T12:09:45.636312 #18885] DEBUG -- Vips::Object.get: out == #<Vips::Image:0x0000563bab1de6a0>
D, [2018-05-12T12:09:45.636374 #18885] DEBUG -- Vips::Operation.call: result = #<Vips::Image:0x0000563bab1de6a0>
D, [2018-05-12T12:09:45.637087 #18885] DEBUG -- Vips::VipsOperation.call: name = cast, supplied = [#<Image 9x8 uchar, 1 bands, b-w>, "int"], optional = {}, option_string = 
D, [2018-05-12T12:09:45.637282 #18885] DEBUG -- Vips::Object.set: in = #<Vips::Image:0x0000563bab1de6a0>
D, [2018-05-12T12:09:45.637508 #18885] DEBUG -- Vips::Object.set: format = int
D, [2018-05-12T12:09:45.637874 #18885] DEBUG -- Vips::Object.get: out == #<Vips::Image:0x0000563bab116970>
D, [2018-05-12T12:09:45.637934 #18885] DEBUG -- Vips::Operation.call: result = #<Vips::Image:0x0000563bab116970>
D, [2018-05-12T12:09:45.638592 #18885] DEBUG -- Vips::VipsOperation.call: name = conv, supplied = [#<Image 9x8 int, 1 bands, b-w>, [1, -1]], optional = {}, option_string = 
D, [2018-05-12T12:09:45.638783 #18885] DEBUG -- Vips::Object.set: in = #<Vips::Image:0x0000563bab116970>
D, [2018-05-12T12:09:45.639309 #18885] DEBUG -- Vips::Object.set: mask = #<Vips::Image:0x0000563bab1537d0>
D, [2018-05-12T12:09:45.643642 #18885] DEBUG -- Vips::Object.get: out == #<Vips::Image:0x0000563bab137e68>
D, [2018-05-12T12:09:45.643740 #18885] DEBUG -- Vips::Operation.call: result = #<Vips::Image:0x0000563bab137e68>
D, [2018-05-12T12:09:45.644673 #18885] DEBUG -- Vips::VipsOperation.call: name = crop, supplied = [#<Image 9x8 float, 1 bands, b-w>, 1, 0, 8, 8], optional = {}, option_string = 
D, [2018-05-12T12:09:45.644901 #18885] DEBUG -- Vips::Object.set: input = #<Vips::Image:0x0000563bab137e68>
D, [2018-05-12T12:09:45.645102 #18885] DEBUG -- Vips::Object.set: left = 1
D, [2018-05-12T12:09:45.645225 #18885] DEBUG -- Vips::Object.set: top = 0
D, [2018-05-12T12:09:45.645344 #18885] DEBUG -- Vips::Object.set: width = 8
D, [2018-05-12T12:09:45.645512 #18885] DEBUG -- Vips::Object.set: height = 8
D, [2018-05-12T12:09:45.645757 #18885] DEBUG -- Vips::Object.get: out == #<Vips::Image:0x0000563bab1053c8>
D, [2018-05-12T12:09:45.645817 #18885] DEBUG -- Vips::Operation.call: result = #<Vips::Image:0x0000563bab1053c8>
D, [2018-05-12T12:09:45.646772 #18885] DEBUG -- Vips::VipsOperation.call: name = relational_const, supplied = [#<Image 8x8 float, 1 bands, b-w>, :more, 0], optional = {}, option_string = 
D, [2018-05-12T12:09:45.647008 #18885] DEBUG -- Vips::Object.set: in = #<Vips::Image:0x0000563bab1053c8>
D, [2018-05-12T12:09:45.647220 #18885] DEBUG -- Vips::Object.set: relational = more
D, [2018-05-12T12:09:45.647296 #18885] DEBUG -- Vips::Object.set: c = 0
D, [2018-05-12T12:09:45.647604 #18885] DEBUG -- Vips::Object.get: out == #<Vips::Image:0x0000563bab0d65c8>
D, [2018-05-12T12:09:45.647640 #18885] DEBUG -- Vips::Operation.call: result = #<Vips::Image:0x0000563bab0d65c8>
D, [2018-05-12T12:09:45.648115 #18885] DEBUG -- Vips::VipsOperation.call: name = linear, supplied = [#<Image 8x8 uchar, 1 bands, b-w>, 0.00392156862745098, 0], optional = {}, option_string = 
D, [2018-05-12T12:09:45.648254 #18885] DEBUG -- Vips::Object.set: in = #<Vips::Image:0x0000563bab0d65c8>
D, [2018-05-12T12:09:45.648394 #18885] DEBUG -- Vips::Object.set: a = 0.00392156862745098
D, [2018-05-12T12:09:45.648465 #18885] DEBUG -- Vips::Object.set: b = 0
D, [2018-05-12T12:09:45.648690 #18885] DEBUG -- Vips::Object.get: out == #<Vips::Image:0x0000563bab0ac138>
D, [2018-05-12T12:09:45.648722 #18885] DEBUG -- Vips::Operation.call: result = #<Vips::Image:0x0000563bab0ac138>
D, [2018-05-12T12:09:45.649211 #18885] DEBUG -- Vips::VipsOperation.call: name = cast, supplied = [#<Image 8x8 float, 1 bands, b-w>, "uchar"], optional = {}, option_string = 
D, [2018-05-12T12:09:45.649372 #18885] DEBUG -- Vips::Object.set: in = #<Vips::Image:0x0000563bab0ac138>
D, [2018-05-12T12:09:45.649537 #18885] DEBUG -- Vips::Object.set: format = uchar
D, [2018-05-12T12:09:45.649788 #18885] DEBUG -- Vips::Object.get: out == #<Vips::Image:0x0000563bab07f3e0>
D, [2018-05-12T12:09:45.649825 #18885] DEBUG -- Vips::Operation.call: result = #<Vips::Image:0x0000563bab07f3e0>
=> 7911847136533597595

from dhash-vips.

kochd avatar kochd commented on May 10, 2024
[1] pry(main)> require 'logger'
=> true
[2] pry(main)> require 'vips'
=> true
[3] pry(main)> GLib::logger.level = Logger::DEBUG 
=> 0
[4] pry(main)> require 'dhash-vips'
=> true
[5] pry(main)> DHashVips::DHash.calculate "00002.jpg"
D, [2018-05-19T05:18:03.493240 #12638] DEBUG -- Vips::VipsOperation.call: name = VipsForeignLoadJpegFile, supplied = ["00002.jpg"], optional = {}, option_string = 
D, [2018-05-19T05:18:03.498236 #12638] DEBUG -- Vips::Object.set: filename = 00002.jpg
D, [2018-05-19T05:18:03.498473 #12638] DEBUG -- Vips::Object.get: out == #
D, [2018-05-19T05:18:03.498501 #12638] DEBUG -- Vips::Operation.call: result = #
D, [2018-05-19T05:18:03.498678 #12638] DEBUG -- Vips::Object.get: width == 1920
D, [2018-05-19T05:18:03.498825 #12638] DEBUG -- Vips::Object.get: height == 1080
D, [2018-05-19T05:18:03.498981 #12638] DEBUG -- Vips::Object.get: width == 1920
D, [2018-05-19T05:18:03.499130 #12638] DEBUG -- Vips::Object.get: height == 1080
D, [2018-05-19T05:18:03.499280 #12638] DEBUG -- Vips::Object.get: format == uchar
D, [2018-05-19T05:18:03.499439 #12638] DEBUG -- Vips::Object.get: bands == 3
D, [2018-05-19T05:18:03.499568 #12638] DEBUG -- Vips::Object.get: interpretation == srgb
D, [2018-05-19T05:18:03.499593 #12638] DEBUG -- Vips::VipsOperation.call: name = resize, supplied = [#, 0.0046875], optional = {:vscale=>0.007407407407407408}, option_string = 
D, [2018-05-19T05:18:03.499673 #12638] DEBUG -- Vips::Object.set: in = #
D, [2018-05-19T05:18:03.499747 #12638] DEBUG -- Vips::Object.set: scale = 0.0046875
D, [2018-05-19T05:18:03.499786 #12638] DEBUG -- Vips::Object.set: vscale = 0.007407407407407408
D, [2018-05-19T05:18:03.503043 #12638] DEBUG -- Vips::Object.get: out == #
D, [2018-05-19T05:18:03.503080 #12638] DEBUG -- Vips::Operation.call: result = #
D, [2018-05-19T05:18:03.503280 #12638] DEBUG -- Vips::Object.get: width == 9
D, [2018-05-19T05:18:03.503405 #12638] DEBUG -- Vips::Object.get: height == 8
D, [2018-05-19T05:18:03.503527 #12638] DEBUG -- Vips::Object.get: format == uchar
D, [2018-05-19T05:18:03.503645 #12638] DEBUG -- Vips::Object.get: bands == 3
D, [2018-05-19T05:18:03.503766 #12638] DEBUG -- Vips::Object.get: interpretation == srgb
D, [2018-05-19T05:18:03.503784 #12638] DEBUG -- Vips::VipsOperation.call: name = colourspace, supplied = [#, "b-w"], optional = {}, option_string = 
D, [2018-05-19T05:18:03.503852 #12638] DEBUG -- Vips::Object.set: in = #
D, [2018-05-19T05:18:03.503923 #12638] DEBUG -- Vips::Object.set: space = b-w
D, [2018-05-19T05:18:03.504075 #12638] DEBUG -- Vips::Object.get: out == #
D, [2018-05-19T05:18:03.504096 #12638] DEBUG -- Vips::Operation.call: result = #
D, [2018-05-19T05:18:03.504220 #12638] DEBUG -- Vips::Object.get: width == 9
D, [2018-05-19T05:18:03.504370 #12638] DEBUG -- Vips::Object.get: height == 8
D, [2018-05-19T05:18:03.504494 #12638] DEBUG -- Vips::Object.get: format == uchar
D, [2018-05-19T05:18:03.504615 #12638] DEBUG -- Vips::Object.get: bands == 1
D, [2018-05-19T05:18:03.504736 #12638] DEBUG -- Vips::Object.get: interpretation == b-w
D, [2018-05-19T05:18:03.504754 #12638] DEBUG -- Vips::VipsOperation.call: name = cast, supplied = [#, "int"], optional = {}, option_string = 
D, [2018-05-19T05:18:03.504809 #12638] DEBUG -- Vips::Object.set: in = #
D, [2018-05-19T05:18:03.504878 #12638] DEBUG -- Vips::Object.set: format = int
D, [2018-05-19T05:18:03.504989 #12638] DEBUG -- Vips::Object.get: out == #
D, [2018-05-19T05:18:03.505009 #12638] DEBUG -- Vips::Operation.call: result = #
D, [2018-05-19T05:18:03.505135 #12638] DEBUG -- Vips::Object.get: width == 9
D, [2018-05-19T05:18:03.505254 #12638] DEBUG -- Vips::Object.get: height == 8
D, [2018-05-19T05:18:03.505546 #12638] DEBUG -- Vips::Object.get: format == int
D, [2018-05-19T05:18:03.505678 #12638] DEBUG -- Vips::Object.get: bands == 1
D, [2018-05-19T05:18:03.505817 #12638] DEBUG -- Vips::Object.get: interpretation == b-w
D, [2018-05-19T05:18:03.505838 #12638] DEBUG -- Vips::VipsOperation.call: name = conv, supplied = [#, [1, -1]], optional = {}, option_string = 
D, [2018-05-19T05:18:03.505920 #12638] DEBUG -- Vips::Object.set: in = #
D, [2018-05-19T05:18:03.506111 #12638] DEBUG -- Vips::Object.set: mask = #
D, [2018-05-19T05:18:03.507414 #12638] DEBUG -- Vips::Object.get: out == #
D, [2018-05-19T05:18:03.507455 #12638] DEBUG -- Vips::Operation.call: result = #
D, [2018-05-19T05:18:03.507624 #12638] DEBUG -- Vips::Object.get: width == 9
D, [2018-05-19T05:18:03.507749 #12638] DEBUG -- Vips::Object.get: height == 8
D, [2018-05-19T05:18:03.507893 #12638] DEBUG -- Vips::Object.get: format == int
D, [2018-05-19T05:18:03.508012 #12638] DEBUG -- Vips::Object.get: bands == 1
D, [2018-05-19T05:18:03.508135 #12638] DEBUG -- Vips::Object.get: interpretation == b-w
D, [2018-05-19T05:18:03.508154 #12638] DEBUG -- Vips::VipsOperation.call: name = crop, supplied = [#, 1, 0, 8, 8], optional = {}, option_string = 
D, [2018-05-19T05:18:03.508236 #12638] DEBUG -- Vips::Object.set: input = #
D, [2018-05-19T05:18:03.508311 #12638] DEBUG -- Vips::Object.set: left = 1
D, [2018-05-19T05:18:03.508346 #12638] DEBUG -- Vips::Object.set: top = 0
D, [2018-05-19T05:18:03.508377 #12638] DEBUG -- Vips::Object.set: width = 8
D, [2018-05-19T05:18:03.508413 #12638] DEBUG -- Vips::Object.set: height = 8
D, [2018-05-19T05:18:03.508508 #12638] DEBUG -- Vips::Object.get: out == #
D, [2018-05-19T05:18:03.508528 #12638] DEBUG -- Vips::Operation.call: result = #
D, [2018-05-19T05:18:03.508654 #12638] DEBUG -- Vips::Object.get: width == 8
D, [2018-05-19T05:18:03.508774 #12638] DEBUG -- Vips::Object.get: height == 8
D, [2018-05-19T05:18:03.508893 #12638] DEBUG -- Vips::Object.get: format == int
D, [2018-05-19T05:18:03.509016 #12638] DEBUG -- Vips::Object.get: bands == 1
D, [2018-05-19T05:18:03.509138 #12638] DEBUG -- Vips::Object.get: interpretation == b-w
D, [2018-05-19T05:18:03.509157 #12638] DEBUG -- Vips::VipsOperation.call: name = relational_const, supplied = [#, :more, 0], optional = {}, option_string = 
D, [2018-05-19T05:18:03.509233 #12638] DEBUG -- Vips::Object.set: in = #
D, [2018-05-19T05:18:03.509323 #12638] DEBUG -- Vips::Object.set: relational = more
D, [2018-05-19T05:18:03.509363 #12638] DEBUG -- Vips::Object.set: c = 0
D, [2018-05-19T05:18:03.509480 #12638] DEBUG -- Vips::Object.get: out == #
D, [2018-05-19T05:18:03.509499 #12638] DEBUG -- Vips::Operation.call: result = #
D, [2018-05-19T05:18:03.509637 #12638] DEBUG -- Vips::Object.get: width == 8
D, [2018-05-19T05:18:03.509756 #12638] DEBUG -- Vips::Object.get: height == 8
D, [2018-05-19T05:18:03.509880 #12638] DEBUG -- Vips::Object.get: format == uchar
D, [2018-05-19T05:18:03.509998 #12638] DEBUG -- Vips::Object.get: bands == 1
D, [2018-05-19T05:18:03.510134 #12638] DEBUG -- Vips::Object.get: interpretation == b-w
D, [2018-05-19T05:18:03.510155 #12638] DEBUG -- Vips::VipsOperation.call: name = linear, supplied = [#, 0.00392156862745098, 0], optional = {}, option_string = 
D, [2018-05-19T05:18:03.510218 #12638] DEBUG -- Vips::Object.set: in = #
D, [2018-05-19T05:18:03.510290 #12638] DEBUG -- Vips::Object.set: a = 0.00392156862745098
D, [2018-05-19T05:18:03.510330 #12638] DEBUG -- Vips::Object.set: b = 0
D, [2018-05-19T05:18:03.510440 #12638] DEBUG -- Vips::Object.get: out == #
D, [2018-05-19T05:18:03.510459 #12638] DEBUG -- Vips::Operation.call: result = #
D, [2018-05-19T05:18:03.510589 #12638] DEBUG -- Vips::Object.get: width == 8
D, [2018-05-19T05:18:03.510729 #12638] DEBUG -- Vips::Object.get: height == 8
D, [2018-05-19T05:18:03.510851 #12638] DEBUG -- Vips::Object.get: format == float
D, [2018-05-19T05:18:03.510968 #12638] DEBUG -- Vips::Object.get: bands == 1
D, [2018-05-19T05:18:03.511090 #12638] DEBUG -- Vips::Object.get: interpretation == b-w
D, [2018-05-19T05:18:03.511107 #12638] DEBUG -- Vips::VipsOperation.call: name = cast, supplied = [#, "uchar"], optional = {}, option_string = 
D, [2018-05-19T05:18:03.511163 #12638] DEBUG -- Vips::Object.set: in = #
D, [2018-05-19T05:18:03.511231 #12638] DEBUG -- Vips::Object.set: format = uchar
D, [2018-05-19T05:18:03.511339 #12638] DEBUG -- Vips::Object.get: out == #
D, [2018-05-19T05:18:03.511358 #12638] DEBUG -- Vips::Operation.call: result = #
vips warning: tilecache: error in tile 0 x 0
FFI::NullPointerError: invalid memory read at address=0x0000000000000000
from /var/lib/gems/2.5.0/gems/ruby-vips-2.0.12/lib/vips/image.rb:478:in `get_bytes'

from dhash-vips.

Nakilon avatar Nakilon commented on May 10, 2024

@kochd do you still experience the issue? Or did you upgrade the libvips and it's gone? Or is the issue not important anymore?

from dhash-vips.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.