Skip to content
This repository has been archived by the owner on Jun 18, 2021. It is now read-only.

Fix CI test failures #62

Closed
wants to merge 4 commits into from
Closed

Conversation

hhellyer
Copy link
Contributor

This PR fixes the compilation errors on SmartOS so that citgm goes green and should resolve issue #50.

Mostly this fixes #ifdefs so we take the correct paths. The code for listing the loaded libraries is the only new code.

I had to make one test change to not check the OS version as calling uname() returns an error on SmartOS. (I formatted the errorno value and it seemed to be "No such file or directory", google suggested that the uname info might come from /etc/release so that might be missing. It's quite hard to tell without access to the machine though.)

Aside from that it seems to be fully functional. If there is extended information that SmartOS provides that other platforms don't (different ulimit values for example) those can be added under other PR's.

There's a CI run with the full set of platforms here:
https://ci.nodejs.org/view/post-mortem/job/nodereport-continuous-integration/83/

Enable node-report on SmartOS.
Mostly fixes #ifdefs so we take the correct paths.
Code for listing the loaded libraries is the only
new code.
Skip test for OS version due to broken uname call.
@hhellyer hhellyer changed the title Enable smartos Fix CI test failures Feb 17, 2017
@rnchamberlain
Copy link
Contributor

LGTM

@sam-github
Copy link
Contributor

@misterdjules, could you take a look at this, please?

@misterdjules
Copy link

@sam-github I will take a look at this today or tomorrow, thanks for the heads up!

@misterdjules
Copy link

Also, let's make sure we mention @nodejs/platform-smartos next time there's a SmartOS specific change to discuss.

Copy link
Member

@richardlau richardlau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I'd like an approval if possible from someone on @nodejs/platform-smartos

@rnchamberlain
Copy link
Contributor

Perhaps @jclulow could approve as he helped out on the issue (#50). He's not in @nodejs/platform-smartos though.

@misterdjules
Copy link

@hhellyer

I had to make one test change to not check the OS version as calling uname() returns an error on SmartOS.

The code in node-report seems to consider that a call to uname is successful only if uname returns 0. This is the behavior described by the Linux man page for the uname function.

However, it is not the case on all POSIX environments. For instance, on SmartOS uname can return 1 or any non-negative value to communicate success. This is described in the POSIX standard.

This is confirmed by tracing the execution of the uname in a SmartOS zone:

[root@ff16a225-3889-4644-a2a7-b5b963bcdded ~]# truss uname
execve("/opt/local/bin/guname", 0xFFFFBF7FFFDFFB28, 0xFFFFBF7FFFDFFB38)  argc = 1
sysinfo(SI_MACHINE, "i86pc", 257)               = 6
mmap(0x00000000, 56, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFBF7FFF380000
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFBF7FFF370000
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFBF7FFF360000
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFBF7FFF350000
memcntl(0xFFFFBF7FFF398000, 97288, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFBF7FFF340000
memcntl(0x00400000, 18096, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
resolvepath("/usr/lib/amd64/ld.so.1", "/lib/amd64/ld.so.1", 1023) = 18
resolvepath("/opt/local/bin/guname", "/opt/local/bin/guname", 1023) = 21
stat("/opt/local/bin/guname", 0xFFFFBF7FFFDFF800) = 0
open("/var/ld/64/ld.config", O_RDONLY)          = 3
fstat(3, 0xFFFFBF7FFFDFF560)                    = 0
mmap(0x00000000, 160, PROT_READ, MAP_SHARED, 3, 0) = 0xFFFFBF7FFF330000
close(3)                                        = 0
stat("/opt/local/lib//libintl.so.8", 0xFFFFBF7FFFDFEEF0) = 0
resolvepath("/opt/local/lib//libintl.so.8", "/opt/local/lib/libintl.so.8.1.5", 1023) = 31
open("/opt/local/lib//libintl.so.8", O_RDONLY)  = 3
mmapobj(3, MMOBJ_INTERPRET, 0xFFFFBF7FFF340D20, 0xFFFFBF7FFFDFEA4C, 0x00000000) = 0
close(3)                                        = 0
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFBF7FFF320000
memcntl(0xFFFFBF174A650000, 16680, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
stat("/opt/local/lib//libiconv.so.2", 0xFFFFBF7FFFDFEEF0) = 0
resolvepath("/opt/local/lib//libiconv.so.2", "/opt/local/lib/libiconv.so.2.5.1", 1023) = 32
open("/opt/local/lib//libiconv.so.2", O_RDONLY) = 3
mmapobj(3, MMOBJ_INTERPRET, 0xFFFFBF7FFF320AC0, 0xFFFFBF7FFFDFEA4C, 0x00000000) = 0
close(3)                                        = 0
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFBF7FFF310000
memcntl(0xFFFFBF1789E20000, 39464, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
stat("/opt/local/lib//libc.so.1", 0xFFFFBF7FFFDFEEF0) Err#2 ENOENT
stat("/opt/local/gcc49/x86_64-sun-solaris2.11/lib/amd64/libc.so.1", 0xFFFFBF7FFFDFEEF0) Err#2 ENOENT
stat("/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.4/libc.so.1", 0xFFFFBF7FFFDFEEF0) Err#2 ENOENT
stat("/opt/local/lib/libc.so.1", 0xFFFFBF7FFFDFEEF0) Err#2 ENOENT
stat("/lib/64/libc.so.1", 0xFFFFBF7FFFDFEEF0)   = 0
resolvepath("/lib/64/libc.so.1", "/lib/amd64/libc.so.1", 1023) = 20
open("/lib/64/libc.so.1", O_RDONLY)             = 3
mmapobj(3, MMOBJ_INTERPRET, 0xFFFFBF7FFF310AF8, 0xFFFFBF7FFFDFEA4C, 0x00000000) = 0
close(3)                                        = 0
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFBF7FFF160000
memcntl(0xFFFFBF7FFF170000, 473576, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
stat("/opt/local/lib//libumem.so.1", 0xFFFFBF7FFFDFEEF0) Err#2 ENOENT
stat("/opt/local/gcc49/x86_64-sun-solaris2.11/lib/amd64/libumem.so.1", 0xFFFFBF7FFFDFEEF0) Err#2 ENOENT
stat("/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.4/libumem.so.1", 0xFFFFBF7FFFDFEEF0) Err#2 ENOENT
stat("/opt/local/lib/libumem.so.1", 0xFFFFBF7FFFDFEEF0) Err#2 ENOENT
stat("/lib/64/libumem.so.1", 0xFFFFBF7FFFDFEEF0) = 0
resolvepath("/lib/64/libumem.so.1", "/lib/amd64/libumem.so.1", 1023) = 23
open("/lib/64/libumem.so.1", O_RDONLY)          = 3
mmapobj(3, MMOBJ_INTERPRET, 0xFFFFBF7FFF160B90, 0xFFFFBF7FFFDFEA4C, 0x00000000) = 0
close(3)                                        = 0
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFBF7FFF150000
memcntl(0xFFFFBF7FFEBC0000, 423600, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
stat("/opt/local/lib//libssp.so.0", 0xFFFFBF7FFFDFEEF0) Err#2 ENOENT
stat("/opt/local/gcc49/x86_64-sun-solaris2.11/lib/amd64/libssp.so.0", 0xFFFFBF7FFFDFEEF0) = 0
resolvepath("/opt/local/gcc49/x86_64-sun-solaris2.11/lib/amd64/libssp.so.0", "/opt/local/gcc49/x86_64-sun-solaris2.11/lib/amd64/libssp.so.0.0.0", 1023) = 65
open("/opt/local/gcc49/x86_64-sun-solaris2.11/lib/amd64/libssp.so.0", O_RDONLY) = 3
mmapobj(3, MMOBJ_INTERPRET, 0xFFFFBF7FFF1509D8, 0xFFFFBF7FFFDFEA4C, 0x00000000) = 0
close(3)                                        = 0
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFBF7FFF140000
memcntl(0xFFFFBF0B80220000, 7656, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
stat("/opt/local/lib//libgcc_s.so.1", 0xFFFFBF7FFFDFEEF0) Err#2 ENOENT
stat("/opt/local/gcc49/x86_64-sun-solaris2.11/lib/amd64/libgcc_s.so.1", 0xFFFFBF7FFFDFEEF0) = 0
resolvepath("/opt/local/gcc49/x86_64-sun-solaris2.11/lib/amd64/libgcc_s.so.1", "/opt/local/gcc49/x86_64-sun-solaris2.11/lib/amd64/libgcc_s.so.1", 1023) = 63
open("/opt/local/gcc49/x86_64-sun-solaris2.11/lib/amd64/libgcc_s.so.1", O_RDONLY) = 3
mmapobj(3, MMOBJ_INTERPRET, 0xFFFFBF7FFF150CD8, 0xFFFFBF7FFFDFEA4C, 0x00000000) = 0
close(3)                                        = 0
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFBF7FFF130000
memcntl(0xFFFFBF0F6A630000, 29064, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
stat("/opt/local/gcc49/lib/amd64/libc.so.1", 0xFFFFBF7FFFDFEEF0) Err#2 ENOENT
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFBF7FFF120000
mmap(0x00010000, 24576, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON|MAP_ALIGN, -1, 0) = 0xFFFFBF7FFF110000
getcontext(0xFFFFBF7FFFDFF250)
getrlimit(RLIMIT_STACK, 0xFFFFBF7FFFDFF5B0)     = 0
getpid()                                        = 71107 [71106]
lwp_private(0, 0, 0xFFFFBF7FFF112A40)           = 0x00000000
setustack(0xFFFFBF7FFF112AE8)
lwp_cond_broadcast(0xFFFFBF7FFF1601A8)          = 0
sysconfig(_CONFIG_STACK_PROT)                   = 3
lwp_cond_broadcast(0xFFFFBF7FFF1301A8)          = 0
sysconfig(_CONFIG_PAGESIZE)                     = 4096
lwp_cond_broadcast(0xFFFFBF7FFF1501A8)          = 0
open("/dev/urandom", O_RDONLY)                  = 3
read(3, " .88B9B0A9B6 s f", 8)                  = 8
close(3)                                        = 0
lwp_cond_broadcast(0xFFFFBF7FFF1401A8)          = 0
lwp_cond_broadcast(0xFFFFBF7FFF3101A8)          = 0
lwp_cond_broadcast(0xFFFFBF7FFF3201A8)          = 0
lwp_cond_broadcast(0xFFFFBF7FFF3401A8)          = 0
sysi86(SI86FPSTART, 0xFFFFBF7FFFDFFADC, 0x0000133F, 0x00001F80) = 0x00000001
mmap(0x00010000, 65536, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON|MAP_ALIGN, 4294967295, 0) = 0xFFFFBF7FFF0F0000
open("/usr/lib/locale//en_US.UTF-8/LC_CTYPE/LCL_DATA", O_RDONLY) = 3
fstat(3, 0xFFFFBF7FFFDFEF20)                    = 0
mmap(0x00000000, 94904, PROT_READ, MAP_PRIVATE, 3, 0) = 0xFFFFBF7FFF0D7000
close(3)                                        = 0
mmap(0x00010000, 262144, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON|MAP_ALIGN, 4294967295, 0) = 0xFFFFBF7FFF090000
munmap(0xFFFFBF7FFF0D7000, 94904)               = 0
open("/usr/lib/locale//en_US.UTF-8/LC_NUMERIC/LCL_DATA", O_RDONLY) = 3
fstat(3, 0xFFFFBF7FFFDFF330)                    = 0
read(3, " .\n ,\n 3\n", 6)                      = 6
close(3)                                        = 0
open("/usr/lib/locale//en_US.UTF-8/LC_TIME/LCL_DATA", O_RDONLY) = 3
fstat(3, 0xFFFFBF7FFFDFF340)                    = 0
read(3, " J a n\n F e b\n M a r\n".., 308)      = 308
close(3)                                        = 0
open("/usr/lib/locale//en_US.UTF-8/LC_COLLATE/LCL_DATA", O_RDONLY) = 3
fstat(3, 0xFFFFBF7FFFDFF390)                    = 0
mmap(0x00000000, 75408, PROT_READ, MAP_PRIVATE, 3, 0) = 0xFFFFBF7FFF0DC000
close(3)                                        = 0
open("/usr/lib/locale//en_US.UTF-8/LC_MONETARY/LCL_DATA", O_RDONLY) = 3
fstat(3, 0xFFFFBF7FFFDFF330)                    = 0
read(3, " U S D  \n $\n .\n ,\n 3".., 44)       = 44
close(3)                                        = 0
open("/usr/lib/locale//en_US.UTF-8/LC_MESSAGES/LCL_DATA", O_RDONLY) = 3
fstat(3, 0xFFFFBF7FFFDFF330)                    = 0
read(3, " ^ ( ( [ y Y ] ( [ e E ]".., 45)       = 45
close(3)                                        = 0
schedctl()                                      = 0xFFFFBF7FFF080000
priocntlsys(1, 0xFFFFBF7FFFDFF2D0, 3, 0xFFFFBF7FFFDFF420, 0) = 71107
priocntlsys(1, 0xFFFFBF7FFFDFF230, 1, 0xFFFFBF7FFFDFF350, 0) = 6
priocntlsys(1, 0xFFFFBF7FFFDFF1E0, 0, 0xFFFFBF7FFF301F74, 0) = 6
priocntlsys(1, 0xFFFFBF7FFFDFF1E0, 5, 0xFFFFBF7FFFDFF300, 0) = 0
priocntlsys(1, 0xFFFFBF7FFFDFF310, 11, 0xFFFFBF7FFFDFF450, 0) = 0
mmap(0x00000000, 131072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFBF7FFF05F000
mmap(0x00000000, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0xFFFFBF7FFF040000
sigaction(SIGCANCEL, 0xFFFFBF7FFFDFEFF0, 0x00000000) = 0
mmap(0x00000000, 2088960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON, 4294967295, 0) = 0xFFFFBF7FFEE41000
mmap(0x00010000, 65536, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON|MAP_ALIGN, 4294967295, 0) = 0xFFFFBF7FFEE30000
uucopy(0xFFFFBF7FFFDFEFB0, 0xFFFFBF7FFF03EFE8, 24) = 0
lwp_create(0xFFFFBF7FFFDFF0C0, LWP_SUSPENDED, 0xFFFFBF7FFFDFF42C) = 2
/1:     lwp_continue(2)                                 = 0
/2:     lwp_create()    (returning as new lwp ...)      = 0
/2:     setustack(0xFFFFBF7FFEE302E8)
/2:     schedctl()                                      = 0xFFFFBF7FFF080010
/2:     lwp_sigmask(SIG_SETMASK, 0xFFBFFEFF, 0xFFFFFFF7, 0x000003FF, 0x00000000) = 0xFFBFFEFF [0xFFFFFFFF]
/2:     open("/usr/lib/locale/en_US.UTF-8/LC_MESSAGES/SUNW_OST_SGS.mo", O_RDONLY) Err#2 ENOENT
/2:     lwp_exit()
lwp_wait(2, 0xFFFFBF7FFFDFF49C)                 = 0
sysconfig(_CONFIG_NPROC_ONLN)                   = 48
issetugid()                                     = 0
open("/usr/lib/locale/en_US.UTF-8/LC_MESSAGES/SUNW_OST_OSLIB.mo", O_RDONLY) Err#2 ENOENT
issetugid()                                     = 0
brk(0x00431000)                                 = 0
brk(0x00441000)                                 = 0
brk(0x00451000)                                 = 0
brk(0x00461000)                                 = 0
brk(0x00471000)                                 = 0
brk(0x00481000)                                 = 0
brk(0x00491000)                                 = 0
brk(0x004A1000)                                 = 0
brk(0x004B1000)                                 = 0
brk(0x004C1000)                                 = 0
brk(0x004D1000)                                 = 0
brk(0x004E1000)                                 = 0
brk(0x004F1000)                                 = 0
uname(0xFFFFBF7FFFDFF5D0)                       = 1
ioctl(1, TCGETA, 0xFFFFBF7FFFDFF410)            = 0
fstat(1, 0xFFFFBF7FFFDFF390)                    = 0
SunOSwrite(1, " S u n O S", 5)                  = 5

write(1, "\n", 1)                               = 1
close(1)                                        = 0
close(2)                                        = 0
_exit(0)
[root@ff16a225-3889-4644-a2a7-b5b963bcdded ~]#

Note the following call to the uname syscall:

uname(0xFFFFBF7FFFDFF5D0)                       = 1

In other words, the Linux man page is not incorrect, but I believe node-report's implementation should stick to the POSIX standard and consider any non-negative return value for uname as a success.

I would think that what could have happened in the case the formatted errno value was "No such file or directory" is that errno was set by another call to another function, and that the call to uname actually succeeded.

Do you mind making that change, re-enabling the relevant test on SmartOS and trying to run the tests again?

Copy link

@misterdjules misterdjules left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the uname issue I pointed at is fixed, I believe this will look good to me. Thank you very much for doing this, it is very much appreciated!

@@ -25,6 +25,8 @@ if (common.isWindows()) {
tap.match(version_str,
new RegExp('OS version: ' + os_name + ' \\d+.' + os.release()),
'Checking OS version');
} else if (common.isSunOS()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cross referencing this with my earlier comment at #62 (comment). I believe we should be able to not skip this test.

Fix SmartOS uname call - returns >= 0 on success not 0.
Add 'sunos' -> 'SunOS' to the map of operating systems.
@hhellyer
Copy link
Contributor Author

Ah, standards versus de facto standards. Fixed.
(I've hit the same kind of thing a few times on AIX too.)

@@ -31,7 +31,7 @@ if (process.argv[2] === 'child') {
const options = {pid: child.pid};
// Node.js currently overwrites the command line on AIX

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: we might want to update the comment so that it mentions that node currently overwrites the command line arguments on SmartOS too.

@hhellyer
Copy link
Contributor Author

@misterdjules - Have you verified that node.js does corrupt the arguments on SmartOS? AIX and SmartOS do handle the command line slightly differently in some ways. For example there's one more level of indirection to the array on AIX:

#ifdef _AIX
      char **argv = *((char ***) info.pr_argv);
     for (uint32_t i = 0; i < info.pr_argc; i++) {
 #else
     char **argv = ((char **) info.pr_argv);
 #endif

It might have the same bug but I'm reluctant to say so without testing it on a SmartOS box. You could try the test at the top of the node bug I raised for AIX: nodejs/node#10607

@misterdjules
Copy link

@hhellyer

I'm on vacation with limited connectivity and no laptop, so please accept my excuses for the quick response and the lack of details and references. Also, i do not have access to my current work on that topic, so i'm writing based on what i remember, and i could be forgetting some important details.

Yes, i tested that node on SmartOS overwrites the process's command line argument because libuv's uv_setup_args is a no-op, and returns the original address of the arguments, which are thus modified by node's startup routines.

I have changes in progress to fix that and libuv's proc title related functions on SmartOS as soon as I get some time to work on that.

I'll be back in 6 days, so don't let that nit hold you back from landing these changes, but if you agree with my recollection of SmartOS issue with command line arguments, then feel free to update the comment as i suggested.

rnchamberlain pushed a commit that referenced this pull request Feb 23, 2017
Enable node-report on SmartOS. Mostly fixes #ifdefs
so we take the correct paths. Code for listing the
loaded libraries is the only new code. Allow for
POSIX non-negative return values from uname().

PR-URL: #62
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Julien Gilli <jgilli@fastmail.fm>
@rnchamberlain
Copy link
Contributor

Landed as b082144

@richardlau
Copy link
Member

Just noticed we forgot to update the README.md. Raised #64.

@hhellyer hhellyer deleted the enable_smartos branch April 26, 2017 14:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants