Getting PCI: Fatal: No config space access function found

Hey there I have a Phoenix app and I’m getting the following errors on restart and I think it’s causing response times of what used to be 4ms to be 300ms - 600ms

 2023-07-27T14:28:32.583 app[6e82d75ea51587] ewr [info] WARN Reaped child process with pid: 313 and signal: SIGUSR1, core dumped? false

2023-07-27T14:28:33.562 app[e784eee4c65728] ewr [info] [ 536.889849] reboot: Restarting system

2023-07-27T14:28:33.967 app[e784eee4c65728] ewr [info] [ 0.037094] PCI: Fatal: No config space access function found

2023-07-27T14:28:34.176 app[e784eee4c65728] ewr [info] INFO Starting init (commit: 1d1821d)...

2023-07-27T14:28:34.190 app[e784eee4c65728] ewr [info] INFO Preparing to run: `/app/bin/server` as nobody

2023-07-27T14:28:34.196 app[e784eee4c65728] ewr [info] INFO [fly api proxy] listening at /.fly/api

2023-07-27T14:28:34.204 app[e784eee4c65728] ewr [info] 2023/07/27 14:28:34 listening on [fdaa:0:6a15:a7b:cc:87d6:4859:2]:22 (DNS: [fdaa::3]:53) 

For the PCI errror I’ve reviewed all of the other posts but none seem to fit what I’m dealing with.
Then, when I deploy I have this notification pop up in my terminal

WARNING The app is not listening on the expected address and will not be reachable by fly-proxy.
You can fix this by configuring your app to listen on the following addresses:
  - 0.0.0.0:0
Found these processes inside the machine with open listening sockets:
  PROCESS                                                                                                                                                                                                                                                                                                                                                                                             | ADDRESSES                            
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*--------------------------------------
  /app/erts-14.0.2/bin/beam.smp -- -root /app -bindir /app/erts-14.0.2/bin -progname erl -- -home /nonexistent -- -proto_dist inet6_tcp -- -noshell -s elixir start_cli -mode embedded -setcookie 5INFUZVPMQX2J7FIK7AGGVRYRO3XVZMQJ77RPUVNAWNMT6BZ2A4Q==== -sname thought_tamer_ex -config /app/releases/0.1.0/sys -boot /app/releases/0.1.0/start -boot_var RELEASE_LIB /app/lib -- -extra --no-halt | [::]:41127, [::]:8080                
  /.fly/hallpass                                                                                                                                                                                                                                                                                                                                                                                      | [fdaa:0:6a15:a7b:cc:87d6:4859:2]:22  
  /app/erts-14.0.2/bin/epmd -daemon                                                                                                                                                                                                                                                                                                                                                                   | 0.0.0.0:4369, [::]:4369              

I’ve tried looking at others posts but it doesn’t seem to fit mine unless I’m completely blind.

epmd -daemon is not my app and has been discussed here but not sure how to handle this:

Would really love some help. I know it’s not a memory issue cause I’m floating around 170mb, and I get the same response times at 512MB (currently at 256MB)

I’ll link any files needed, but I don’t know which ones could be causing this besides prod and runtime configs

prod.exs

import Config

# For production, don't forget to configure the url host
# to something meaningful, Phoenix uses this information
# when generating URLs.
#
# Note we also include the path to a cache manifest
# containing the digested version of static files. This
# manifest is generated by the `mix phx.digest` task,
# which you should run after static files are built and
# before starting your production server.
config :thought_tamer_ex, ThoughtTamerExWeb.Endpoint,
  cache_static_manifest: "priv/static/cache_manifest.json"

# Do not print debug messages in production
config :logger, level: :info

# ## SSL Support
#
# To get SSL working, you will need to add the `https` key
# to the previous section and set your `:url` port to 443:
#
# config :thought_tamer_ex, ThoughtTamerExWeb.Endpoint,
#   ...,
#   url: [host: "example.com", port: 443],
#   https: [
#     ...,
#     port: 443,
#     cipher_suite: :strong,
#     keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"),
#     certfile: System.get_env("SOME_APP_SSL_CERT_PATH")
#   ]
#
# The `cipher_suite` is set to `:strong` to support only the
# latest and more secure SSL ciphers. This means old browsers
# and clients may not be supported. You can set it to
# `:compatible` for wider support.
#
# `:keyfile` and `:certfile` expect an absolute path to the key
# and cert in disk or a relative path inside priv, for example
# "priv/ssl/server.key". For all supported SSL configuration
# options, see https://hexdocs.pm/plug/Plug.SSL.html#configure/1
#
# We also recommend setting `force_ssl` in your endpoint, ensuring
# no data is ever sent via http, always redirecting to https:
#
#     config :thought_tamer_ex, ThoughtTamerExWeb.Endpoint,
#       force_ssl: [hsts: true]
#
# Check `Plug.SSL` for all available options in `force_ssl`.

runtime.exs

import Config

# config/runtime.exs is executed for all environments, including
# during releases. It is executed after compilation and before the
# system starts, so it is typically used to load production configuration
# and secrets from environment variables or elsewhere. Do not define
# any compile-time configuration in here, as it won't be applied.
# The block below contains prod specific runtime configuration.

# ## Using releases
#
# If you use `mix release`, you need to explicitly enable the server
# by passing the PHX_SERVER=true when you start it:
#
#     PHX_SERVER=true bin/thought_tamer_ex start
#
# Alternatively, you can use `mix phx.gen.release` to generate a `bin/server`
# script that automatically sets the env var above.
if System.get_env("PHX_SERVER") do
  config :thought_tamer_ex, ThoughtTamerExWeb.Endpoint, server: true
end

if config_env() == :prod do
  database_url =
    System.get_env("DATABASE_URL") ||
      raise """
      environment variable DATABASE_URL is missing.
      For example: ecto://USER:PASS@HOST/DATABASE
      """

  maybe_ipv6 = if System.get_env("ECTO_IPV6"), do: [:inet6], else: []

  config :thought_tamer_ex, ThoughtTamerEx.Repo,
    # ssl: true,
    url: database_url,
    pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
    socket_options: maybe_ipv6

  # The secret key base is used to sign/encrypt cookies and other secrets.
  # A default value is used in config/dev.exs and config/test.exs but you
  # want to use a different value for prod and you most likely don't want
  # to check this value into version control, so we use an environment
  # variable instead.
  secret_key_base =
    System.get_env("SECRET_KEY_BASE") ||
      raise """
      environment variable SECRET_KEY_BASE is missing.
      You can generate one by calling: mix phx.gen.secret
      """

  host = System.get_env("PHX_HOST") || "example.com"
  port = String.to_integer(System.get_env("PORT") || "4000")

  config :thought_tamer_ex, ThoughtTamerExWeb.Endpoint,
    url: [host: host, port: 443, scheme: "https"],
    http: [
      # Enable IPv6 and bind on all interfaces.
      # Set it to  {0, 0, 0, 0, 0, 0, 0, 1} for local network only access.
      # See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html
      # for details about using IPv6 vs IPv4 and loopback vs public addresses.
      ip: {0, 0, 0, 0, 0, 0, 0, 0},
      port: port
    ],
    secret_key_base: secret_key_base

  # ## Configuring the mailer
  #
  # In production you need to configure the mailer to use a different adapter.
  # Also, you may need to configure the Swoosh API client of your choice if you
  # are not using SMTP. Here is an example of the configuration:
  #
  config :thought_tamer_ex, ThoughtTamerEx.Mailer,
    adapter: Swoosh.Adapters.Mailgun,
    api_key: System.get_env("MAILGUN_API_KEY"),
    domain: System.get_env("MAILGUN_DOMAIN")

  config :swoosh, :api_client, Swoosh.ApiClient.Finch
  #
  # See https://hexdocs.pm/swoosh/Swoosh.html#module-installation for details.
end

Thanks in advance

I’m seeing something similar with a Node Remix app.

2 Likes

Hello @Morzaram and @gsong! My understanding is that PCI: Fatal: No config space access function found is a harmless, while disconcerting, message coming from the Linux kernel on boot.

From the kernel mailing list, [PATCH] x86/hyperv: suppress "PCI: Fatal: No config space access function found" - Dexuan Cui :

A Generatin-2 Linux VM on Hyper-V doesn’t have the legacy PCI bus, and
users always see the scary warning, which is actually harmless. The patch
is made to suppress the warning.

1 Like

The real error is when the app starts back up, the reverse proxy cannot reach the app’s configured port:

instance refused connection. is your app listening on 0.0.0.0:3000? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)

In our case it’s just the machine spinning down to zero, and spinning back up when someone hits the app.

If your app uses Phoenix, then epmd is a component of the Erlang set of processes on top of which your Elixir code runs.

The other process (beam) is the virtual machine on which Elixir (and Erlang!) run - that’s your application. The process list shows this application is listening on port 8080, but the message:

You can fix this by configuring your app to listen on the following addresses:
  - 0.0.0.0:0

suggests the Fly proxy is expecting your app to be serving/listening on port 0, which is… rather odd. I would expect a section in your fly.toml indicating the app is listening on port 8080, instructing the proxy to talk to it on that port:

[http_service]
  internal_port = 8080
  processes = ["app"]

If you don’t have this or something similar on your fly.toml, maybe that’s what’s amiss or borked.

Feel free to share your fly.toml for the helpful folk in the forum to have a look.

Cheers,

  • Daniel

@gsong I see! For issues related to port configuration errors you’re probably best to start a new topic with corresponding title.

Here’s my fly.toml

app = "selftalk"
kill_signal = "SIGTERM"
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 1

[deploy]
  release_command = "/app/bin/migrate"

[env]
  PHX_HOST = "selftalk.fly.dev"
  PORT = "8080"

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 1
  processes = ["app"]
  [http_service.concurrency]
    type = "connections"
    hard_limit = 1000
    soft_limit = 1000

Thanks,

Okay, thanks, I guess the FATAL is misleading haha

As soon as I moved locations from ‘ewr’ to ‘ams’ reponse times went back down to 10ms. I’m not sure if there is an issue at ewr, or not but it’s stable again

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.