Ticket #123 (closed defect: fixed)
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
Change History
comment:1 Changed 4 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);


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