Modify

Ticket #123 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

libyaml parser hangs when reading all in one read from a TCP socket.

Reported by: pem@… Owned by: xi
Priority: normal Component: libyaml
Severity: major Keywords:
Cc:

Description

When setting a read handler (which uses read(2)) with yaml_parser_set_input() and reading from a socket descriptor, it happens that the entire yaml document is read in one call of the handler. This seems to confuse the parser (yaml_parser_load()) which calls the handler again, attempting to read more.

Forcing at least two packages from the client makes it work. The workaround was to make the client write and flush the leading "---" separately, and then dump the rest on the socket.

This is with libyaml 0.1.2. The client side is using SnakeYAML 1.1 (with java 1.6), both on openSuse 11.0.

Attachments

bug123.c Download (2.3 KB) - added by pem@… 5 years ago.
Test program, compile and run with "./bug123".

Change History

Changed 5 years ago by pem@…

Test program, compile and run with "./bug123".

comment:1 Changed 5 years ago by xi

  • Status changed from new to assigned

Confirmed, yaml_parser_update_buffer() calls yaml_parser_update_raw_buffer() at least twice at the beginning of the stream, the first time to determine the stream encoding, the second time while decoding the stream.

A possible workaround is to set the encoding explicitly:

yaml_parser_set_encoding(&parser, YAML_UTF8_ENCODING);

comment:2 Changed 5 years ago by xi

  • Status changed from assigned to closed
  • Resolution set to fixed

Thank you for the report. Fixed in [352].

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.