* Client/Server and output
@ 2014-08-21 14:28 Castor Fu
2014-08-22 22:15 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Castor Fu @ 2014-08-21 14:28 UTC (permalink / raw)
To: fio
I've been having problems with the client/server mode of fio where
occasionally I will get CRC errors or packet mismatches.
I think the source of the problem is that the file descriptor for the
socket is 1 or 2 and something is writing to stdout or stderr. After
I cleaned up some problems with my plugin the problem seems to have
gone away.
It looks like there are a few places where this can happen:
In fio.h fio_assert writes to stderr ... Maybe this should use f_err?
The debug malloc also writes to stderr if it detects memory corruption...
Also in json_object_add_client_info, if no hostname is specified,
client->hostname is NULL so we'll dump core...
iff --git a/client.c b/client.c
index 1f52734..78a957e 100644
--- a/client.c
+++ b/client.c
@@ -825,7 +825,8 @@ static void convert_gs(struct group_run_stats
*dst, struct group_run_stats *src)
static void json_object_add_client_info(struct json_object *obj,
struct fio_client *client)
{
- json_object_add_value_string(obj, "hostname", client->hostname);
+ const char *hostname = client->hostname ? client->hostname : "";
+ json_object_add_value_string(obj, "hostname", hostname);
json_object_add_value_int(obj, "port", client->port);
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: Client/Server and output
2014-08-21 14:28 Client/Server and output Castor Fu
@ 2014-08-22 22:15 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2014-08-22 22:15 UTC (permalink / raw)
To: Castor Fu, fio
On 2014-08-21 09:28, Castor Fu wrote:
> I've been having problems with the client/server mode of fio where
> occasionally I will get CRC errors or packet mismatches.
>
> I think the source of the problem is that the file descriptor for the
> socket is 1 or 2 and something is writing to stdout or stderr. After
> I cleaned up some problems with my plugin the problem seems to have
> gone away.
>
> It looks like there are a few places where this can happen:
>
> In fio.h fio_assert writes to stderr ... Maybe this should use f_err?
>
> The debug malloc also writes to stderr if it detects memory corruption...
>
> Also in json_object_add_client_info, if no hostname is specified,
> client->hostname is NULL so we'll dump core...
>
> iff --git a/client.c b/client.c
> index 1f52734..78a957e 100644
> --- a/client.c
> +++ b/client.c
> @@ -825,7 +825,8 @@ static void convert_gs(struct group_run_stats
> *dst, struct group_run_stats *src)
> static void json_object_add_client_info(struct json_object *obj,
> struct fio_client *client)
> {
> - json_object_add_value_string(obj, "hostname", client->hostname);
> + const char *hostname = client->hostname ? client->hostname : "";
> + json_object_add_value_string(obj, "hostname", hostname);
> json_object_add_value_int(obj, "port", client->port);
> }
Thanks for the patch, will apply it.
On the fd being 1 or 2, that's a really good point. It might be a good
idea to just ensure that we keep them open, instead of closing them and
wreaking havoc if some odd code path ends up writing to stdout or
stderr. That would seem a much safer option... Basically just remove the
closing of STDOUT/STDERR in fio_start_server().
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-22 22:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-21 14:28 Client/Server and output Castor Fu
2014-08-22 22:15 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox