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

runtime error: invalid memory address or nil pointer dereference #4

Open
whisperzer0 opened this issue Sep 8, 2020 · 2 comments
Open

Comments

@whisperzer0
Copy link

whisperzer0 commented Sep 8, 2020

Hey, I've had to use a precompiled binary as I couldn't get the source to compile.

[389ds_exporter]$ make
>> checking code style
GOOS= GOARCH= go get -u honnef.co/go/tools/cmd/staticcheck
>> running staticcheck
/home/deploy/go/bin/staticcheck -ignore "" ./...
flag provided but not defined: -ignore
Usage of staticcheck:
        staticcheck [flags] # runs on package in current directory
        staticcheck [flags] packages
        staticcheck [flags] directory
        staticcheck [flags] files... # must be a single package
Flags:
make: *** [Makefile.common:93: common-staticcheck] Error 2

Precompiled Binary

[389ds_exporter-0.1.2.linux-386]$ ./389ds_exporter -ldap.addr "omitted" -ipa-domain "omitted" -ldap.pass "omitted" -web.listen-address "omitted"
INFO[0000] Starting prometheus HTTP metrics server on omitted:9496 
INFO[0000] Starting 389ds scraper for omitted:389  
2020/09/08 12:57:49 ldap: recovered panic in processMessages: runtime error: invalid memory address or nil pointer dereference
ERRO[0060] Scrape failed, error is:LDAP Result Code 200 "Network Error": ldap: response channel closed 
INFO[0060] Scrape completed in 0.000775 seconds         

CentOS Linux release 8.2.2004 (Core)

@whisperzer0
Copy link
Author

whisperzer0 commented Sep 10, 2020

Sort of fixed it.

Comment out the following lines

123: //func objectClass(name string) string {
124: //      return fmt.Sprintf("(objectClass=%v)", name)
125: //}

Alter line 256 with fmt.ErrorF

256: return -1, fmt.Errorf(fmt.Sprintf("No entries contain numSuborindates for %s (%s)", baseDN, searchFilter))

Remove error from import at line 4

3: import (
4: "fmt"
5: "strconv"
6: "strings"
7: "time"

Now starts, but fails on LDAP objects.

INFO[0000] Starting prometheus HTTP metrics server on x:9496 
INFO[0000] Starting 389ds scraper for x:389  
ERRO[0060] Scrape failed, error is:1 error occurred:
        * LDAP Result Code 32 "No Such Object": 
 INFO[0060] Scrape completed in 0.056049 seconds    

I wonder if its due to the commented out objectClass function.

@terricain
Copy link
Owner

I no longer have a FreeIPA to test against, when it says the No Such Object error does http://localhost:9496/metrics return any useful metrics?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants