Informix

nested-group-icon.png

DB2

Expand all | Collapse all

filetoblob error with /dev/null

  • 1.  filetoblob error with /dev/null

    Posted 28 days ago
    Greetings,

    The following statements:
    create temp table foo (x blob) with no log;

    insert into foo values ( filetoblob('/dev/null', 'server') );


    Throw a "22: Invalid argument" error on one of our servers.

    However, I can run the same statements on a simple server (dev licensed), with no issues at all.

    In both cases I run the statements as user informix.

    Also, the informix user can read from or write to /dev/null in either server without any issues from the command shell.

    I'd happily trace the appropriate oninit process, if I knew how to isolate it, or even if I knew how to reduce the number oninit's to a bare minimum, so as to make the trace more manageable.

    Any ideas as to what the issue might be, or how I could reveal the underlying cause would be much appreciated.

    Thanks in advance.



  • 2.  RE: filetoblob error with /dev/null

    Posted 28 days ago
    Danil:

    Not sure why it works on one system and not another. I can say that errno 22 is a system call error indicating that there is an invalid argument to some system call.

    However, I would wonder why you are trying to insert "/dev/null" to a BLOB type column? Do you want to insert a NULL BLOB? If so, this would be the statement:

    insert into foo values (NULL);

    Witness:

    > create temp table foo (x blob) with no log;

    Temporary table created.

    > insert into foo values (NULL);

    1 row(s) inserted.

    > select * from foo;

    x  <SBlob Data>

    1 row(s) retrieved.

    Art
    Art S. Kagel, President and Principal Consultant
    ASK Database Management


    Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference.  Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves.








  • 3.  RE: filetoblob error with /dev/null

    Posted 24 days ago
    Thanks Art.

    The peculiar usage of "/dev/null" appears to be a legacy decision.
    However, have replaced most filetoblob("/dev/null", "server") references with NULL. One was an INSERT INTO a specific variable, so just used "0" (SPL parser didn't like NULL).

    The error 22 was tracked down to the following call:
    ...
    12819 0.000166 open("/dev/null", 16384, 00 <unfinished ...>
    12819 0.000135 SYS_openat(0xffffff9c, 0x6cae2fe0, 0x4000, 0) = -22
    ...

    For some bizarre reason, 0x4000 is used as the oflag when opening /dev/null in the specific VM environment I'm using (?)

    However, when I use the exact same installation (installer, installer options, with a default server), on a different VM, the oflag is 0x00.
    Note: Both VMs are using the same exact Linux OS.

    Which strongly implies it's the underlying VM implementation doing some weird things.
    The "failing" VM is VMWare, the successful one is VirtualBox.

    It's not an issue for us at the moment, with the workaround above, but, interesting to note.

    Kind regards,
    Daniil


  • 4.  RE: filetoblob error with /dev/null

    Posted 24 days ago
    Interesting indeed. HCL should take note and see what's happening there!

    Art

    Art S. Kagel, President and Principal Consultant
    ASK Database Management


    Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference.  Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves.








  • 5.  RE: filetoblob error with /dev/null

    Posted 22 days ago


    I believe the open function is provided by glibc.

    Which glibc version do you have on each platform?

    Regards,

    David.



    ------------------------------
    David Williams
    ------------------------------



  • 6.  RE: filetoblob error with /dev/null

    Posted 22 days ago
    Hi David,

    Hopefully, the stuff you're interested in.

    Kernel:
    $ uname -r
    4.15.0-106-generic

    Checksum:
    $ ldd $(which oninit)|grep -w libc
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f985f3cc000)

    $ cksum /lib/x86_64-linux-gnu/libc.so.6
    167294287 2030544 /lib/x86_64-linux-gnu/libc.so.6

    glibc:
    $ /lib/x86_64-linux-gnu/libc.so.6
    GNU C Library (Ubuntu GLIBC 2.27-3ubuntu1) stable release version 2.27.
    Copyright (C) 2018 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.
    There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
    PARTICULAR PURPOSE.
    Compiled by GNU CC version 7.3.0.
    libc ABIs: UNIQUE IFUNC
    For bug reporting instructions, please see:
    <https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs>.

    Regards,
    Daniil


  • 7.  RE: filetoblob error with /dev/null

    Posted 22 days ago
    I'm reproducing this using "select filetoblob('/dev/null', 'server') from sysmaster:sysdual;" and v12.10.FC14 on Linux.
    It's not reproducing when saying 'client' instead of 'server', or when trying the exact same against v14.10.FC3 - on same machine.

    Going to dig deeper as I'm finding time ...

    Btw.:  0x4000 is O_DIRECT, so will have to find where this is coming from (apparently/expectedly it's not dependent on DIRECT_IO onconfig setting, yet it might be related to introduction of this feature).
    And yes, trying an open("/dev/null", any_flags|O_DIRECT) would indeed yield errno 22.

    Dug deeper:

    I think I'm seeing the change in 14.10[.xC1] that, inadvertently, might have solved this problem.

    Also:  in case your server isn't using raw devices nor DIRECT_IO, so you're not depending on KAIO for your chunks, running the server with KAIOOFF env var (set to anything) seems to be a workaround.

    ------------------------------
    Andreas Legner
    ------------------------------



  • 8.  RE: filetoblob error with /dev/null

    Posted 21 days ago
    Just FYI:

    I'm reproducing this using "select filetoblob('/dev/null', 'server') from sysmaster:sysdual;"  and v12.10 on Linux.
    It does not reproduce when using 'client' instead of 'server', or when trying the exact same with v14.10 - on same machine.  What is your version?

    Going to dig deeper as I'm finding time...

    Btw.:  the 0x4000 is O_DIRECT, and yes, trying an open("/dev/null", flags | O_DIRECT) will yield errno 22.  Will have to find where this O_DIRECT is coming from; it looks to be unrelated to DIRECT_IO onconfig setting (0 in my envs).

    ------------------------------
    Andreas Legner
    ------------------------------



  • 9.  RE: filetoblob error with /dev/null

    Posted 21 days ago
    Hi Andreas,

    I'm using v12.10.FC11.

    Regards,
    Daniil


  • 10.  RE: filetoblob error with /dev/null

    Posted 21 days ago
    Ok, any v12.10, in fact anything since introduction of DIRECT_IO and preceding v14.10, probably would show this behavior.

    Would KAIOOFF, as mentioned in my alternate post, be a viable solution for you?

    ------------------------------
    Andreas Legner
    ------------------------------



  • 11.  RE: filetoblob error with /dev/null

    Posted 20 days ago
    Hi Andreas,

    Yes, setting KAIOOFF made a difference in the (VMWare) VM that was failing. It no longer throws the error. Thanks for that :)

    Although, puzzling that it worked fine on the other (VirtualBox) VM, without the KAIOOFF work-around?

    Kind regards,
    Daniel