Skip to content

Termination with comments in query and .query method #54

Open
@ks-s-a

Description

@ks-s-a

Run such snippet:

const ClickHouse = require('@apla/clickhouse');

const c = new ClickHouse({
  host,
  port,
  auth
});

const q = 'select count() from table
-- ololololoolololololoolololololol
'
const stream = c.query(q);

stream.on('metadata', function (metadata) {
  console.log('metadata', metadata);
});

stream.on('data', function (data) {
  console.log('data!', data);
});

stream.on('error', err => {
  console.log('error', err);
});

stream.on('end', () => {
  console.log('end');
});

stream.on('end', () => {
  console.log('end');
});

And receive nothing. Stream was closed and the script terminated. There were no fired events. However, if I remove comments from the query it will work properly.

I looked at tcpdump and saw that the request was sent to the server. After sending we got 'close' event from http.response inside the client's code then 'response' event and 'close' again.

Tried to send the request with http://ui.tabix.io/ - everything is fine. And it is the reason why I texted here. It looks like client bug, which not related to server settings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions