Error 500 between Gitlab 8.5.4 & Mattermost 2

Hi,

Every time I try to test the connectivity between Gitlab and Mattermost (from the Gitlab side - i.e. the Slack-style integration), I get an Error 500. In the production.log, I see the following error:

Started GET "/testingroup/mattermost/services/slack/test" for 127.0.0.1 at 2016-03-09 11:27:19 -0500
Processing by Projects::ServicesController#test as HTML
Parameters: {"namespace_id"=>"testingroup", "project_id"=>"mattermost", "id"=>"slack"}
Completed 500 Internal Server Error in 150ms (ActiveRecord: 5.5ms)
SocketError (getaddrinfo: Name or service not known):
app/models/project_services/slack_service.rb:101:in `execute'
app/models/service.rb:106:in `test'
app/controllers/projects/services_controller.rb:49:in `test'

This used to work on 8.4.1, but after the update to 8.5 and ever since the connection doesn’t seem to work. Running dig and nslookup on the Gitlab system for the Mattermost URL returns the correct IP, so DNS does not seem to be an issue.

Update: I’ve also run curl to test this; it works flawlessly and Mattermost provides a success response/I can see the message appear in the system.

Thanks!

-James.

1 Like

@jweare

SocketError (getaddrinfo: Name or service not known):

This error usually occurs due to the following:

  • A hostname cannot be resolved to an ip-address which maybe a DNS issue
  • A typo or sometimes even a leading or trailing white space around an otherwise valid hostname

Quick context question, are you running GitLab and mattermost on the same server or different servers?

Also include your /etc/gitlab/gitlab.rb file if possible

Hi @muthuri.kelmut,

Yes, Gitlab and Mattermost are on the same server, and our DNS entries for gitlab.domainname.com and mattermost.domainname.com both point back to this server.

Here’s my gitlab.rb:

external_url 'http://gitlab.domainname.com'
gitlab_rails['time_zone'] = 'America/Toronto'
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = 'ds.gitlab-notification@domainname.com'
gitlab_rails['gitlab_email_display_name'] = 'no-reply'
gitlab_rails['gitlab_email_reply_to'] = 'ds.gitlab-notification@domainname.com'
gitlab_rails['webhook_timeout'] = 10

gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS' # remember to close this block with 'EOS' below
  main: # 'main' is the GitLab 'provider ID' of this LDAP server
    label: 'LDAP'
    host: 'DC.DOMAINNAME.COM'
    port: 636 
    uid: 'sAMAccountName'
    method: 'ssl' # "tls" or "ssl" or "plain"
    bind_dn: 'USERNAME'
    password: 'PASSWORD'
    active_directory: true
    allow_username_or_email_login: false
    block_auto_created_users: true
    base: 'BASE'
    user_filter: ''
    attributes:
      username: ['uid', 'userid', 'sAMAccountName']
      email:    ['mail', 'email', 'userPrincipalName']
      name:       'cn'
      first_name: 'givenName'
      last_name:  'sn'
EOS

gitlab_rails['manage_backup_path'] = true
gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"
gitlab_rails['backup_archive_permissions'] = 0644 
gitlab_rails['backup_pg_schema'] = 'public'
gitlab_rails['backup_keep_time'] = 604800

gitlab_rails['extra_piwik_url'] = "piwik.domainname.com
gitlab_rails['extra_piwik_site_id'] = '1'

gitlab_rails['env'] = {
    'http_proxy' => "proxy.domainname.com:8000",
    'https_proxy' => "proxy.domainname.com:8000"
}

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smpt.domainname.com"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_domain'] = "domainname.com"

unicorn['worker_timeout'] = 60
unicorn['worker_processes'] = 9

mattermost_external_url 'http://mattermost.domainname.com'
mattermost['service_enable_incoming_webhooks'] = true
mattermost['service_enable_post_username_override'] = true
mattermost['service_enable_post_icon_override'] = true
mattermost['service_enable_outgoing_webhooks'] = true
mattermost['team_enable_team_listing'] = true

mattermost['gitlab_enable'] = true
mattermost['gitlab_secret'] = "e1cf6e256ca3801effd3e15a1f1361f83c07dcd145083d8f43e3a46f2e1d064a"
mattermost['gitlab_id'] = "6d910bead9d81be0f0c468d6ec09038abd7b36b156cf7b6b6af16afa03a027eb"
mattermost['gitlab_scope'] = ""
mattermost['gitlab_auth_endpoint'] = "http://gitlab.domainname.com/oauth/authorize"
mattermost['gitlab_token_endpoint'] = "http://gitlab.domainname.com/oauth/token"
mattermost['gitlab_user_api_endpoint'] = "http://gitlab.domainname.com/api/v3/user"

mattermost['email_enable_sign_up_with_email'] = false
mattermost['email_send_email_notifications'] = true
mattermost['email_require_email_verification'] = false
mattermost['email_smtp_server'] = "smtp.domainname.com"
mattermost['email_smtp_port'] = "25"
mattermost['email_connection_security'] = nil
mattermost['email_feedback_name'] = "GitLab Mattermost"
mattermost['email_feedback_email'] = "ds.mattermost-notifications@domainname.com"

Thanks!

Hi @kelvinmutuma,

Any update/ideas? This isn’t game-breaking for me but I’d like to be able to get the integration back up and running as it was prior to the 8.5 upgrade.

Thanks!

OK, I’ve now tested at the gitlab-rails console to ensure that the IP address lookup works there, and it does:

irb(main):002:0> Socket.getaddrinfo("mattermost.domainname.com", "80", nil, :STREAM) => [["AF_INET", 80, "172.25.159.21", "172.25.159.21", 2, 1, 6]] irb(main):001:0> Socket.getaddrinfo("mattermost.domainname.com", "8065", nil, :STREAM) => [["AF_INET", 8065, "172.25.159.21", "172.25.159.21", 2, 1, 6]]

Hi @jweare, sorry for the late response. Thanks for the added info

Just as a confirmation, try running dig gitlab.yourdomain.com on the server. If it returns no A/CNAME, fix your DNS entries.

You can also try using localhost as your url or define an entry on /etc/hosts

Thanks @kelvinmutuma. Dig shows the correct IP in the A record, and /etc/hosts is setup like this:

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 172.25.159.21 mattermost.domainname.com

Even despite that host mapping, the getaddrinfo lookup fails. The addresses are internally routable only - not accessible via the Internet - is it possible that’s creating an issue, given that I had to configure a proxy so that we could import from GitHub?

Hi @kelvinmutuma, I’m still pretty stuck here. Any other ideas?

@kelvinmutuma, One more thing. If I enable the Slack integration as a default (in Gitlab settings), and create a new project, then navigate to that project’s settings to test the integration, the “Test settings” button is greyed out, and hovering over it turns the cursor into a :no_entry_sign:. Changing the settings and clicking “Save settings” does not fix this.

I’ve fixed this issue, though I haven’t really got a clue why it now works. After setting all services to use HTTPS, the integration was sending a new error regarding SSL certificate verification issues. Once I imported my org’s internal root CA, everything works as expected now.

1 Like