⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/mgmt/rpc/server/CommBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct BaseCommInterface {
virtual std::string const &name() const = 0;
};

enum class InternalError { MAX_TRANSIENT_ERRORS_HANDLED = 1, POLLIN_ERROR, PARTIAL_READ, FULL_BUFFER };
enum class InternalError { MAX_TRANSIENT_ERRORS_HANDLED = 1, POLLIN_ERROR, PARTIAL_READ, FULL_BUFFER, INVALID_SOCKET_PATH };
std::error_code make_error_code(rpc::comm::InternalError e);

} // namespace rpc::comm
Expand Down
3 changes: 3 additions & 0 deletions src/mgmt/rpc/server/CommBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ CommInternalErrorCategory::message(int ev) const
return {"No more data to be read, but the buffer contains some invalid? data."};
case rpc::comm::InternalError::FULL_BUFFER:
return {"Buffer's full."};
case rpc::comm::InternalError::INVALID_SOCKET_PATH:
return {"Invalid RPC socket path: the path is either empty or exceeds the maximum length supported by the operating system. "
"Check the value of rpc.unix.sock_path_name in the configuration file."};
default:
return "Internal Communication Error" + std::to_string(ev);
}
Expand Down
8 changes: 4 additions & 4 deletions src/mgmt/rpc/server/IPCSocketServer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,15 @@ IPCSocketServer::configure(YAML::Node const &params)
std::error_code
IPCSocketServer::init()
{
std::error_code ec; // Flag possible errors.
// Need to run some validations on the pathname to avoid issue. Normally this would not be an issue, but some tests may fail on
// this.
if (_conf.sockPathName.empty() || _conf.sockPathName.size() > sizeof _serverAddr.sun_path) {
Dbg(dbg_ctl, "Invalid unix path name, check the size.");
return std::make_error_code(static_cast<std::errc>(ENAMETOOLONG));
Dbg(dbg_ctl, "Invalid unix path name, check the size. Empty or too long.");
ec = InternalError::INVALID_SOCKET_PATH;
return ec;
}

std::error_code ec; // Flag possible errors.

if (this->create_socket(ec); ec) {
return ec;
}
Expand Down
7 changes: 5 additions & 2 deletions src/traffic_server/traffic_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ initialize_jsonrpc_server()
// jsonrpcServer object.
ink_assert(jsonrpcServer == nullptr);
std::string msg;
return {false, swoc::bwprint(msg, "Server failed: '{}'", ex.what())};
return {false, swoc::bwprint(msg, "Error: '{}'", ex.what())};
}
// Register admin handlers.
rpc::admin::register_admin_jsonrpc_handlers();
Expand Down Expand Up @@ -1995,7 +1995,10 @@ main(int /* argc ATS_UNUSED */, const char **argv)
if (!command_flag) { // No need if we are going into command mode.
// JSONRPC server and handlers
if (auto &&[ok, msg] = initialize_jsonrpc_server(); !ok) {
Warning("JSONRPC server could not be started.\n Why?: '%s' ... Continuing without it.", msg.c_str());
fprintf(stderr,
"[ERROR] JSONRPC server could not be started because: '%s', ATS will start without it, but traffic_ctl will not be "
"available.\n",
msg.c_str());
}
}

Expand Down