Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert port number to string automatically #107

Closed
ligurio opened this issue Feb 17, 2022 · 1 comment · Fixed by #108
Closed

Convert port number to string automatically #107

ligurio opened this issue Feb 17, 2022 · 1 comment · Fixed by #108
Labels
bug Something isn't working

Comments

@ligurio
Copy link
Member

ligurio commented Feb 17, 2022

memcached doesn't accept port number as a Lua number, it forces user to convert it to string explicitly.

tarantool> mc.create('instance_2', 8020, {})
2022-02-17 11:17:58.763 [3263879] main/101/interactive I> Initializing SASL: begin
2022-02-17 11:17:58.765 [3263879] main/101/interactive I> Initializing SASL: done
2022-02-17 11:17:58.766 [3263879] main/112/__mc_instance_2_expire I> Memcached expire fiber started
---
- error: 'builtin/uri.lua:46: bad argument #2 to ''uri_parse'' (cannot convert ''number''
    to ''const char *'')'
...

tarantool> 

I think memcached can do it automatically.

@Totktonada Totktonada added 1sp bug Something isn't working labels Feb 17, 2022
ligurio added a commit that referenced this issue Mar 3, 2022
For creating memcached instance module requires instance name, URI and
table with options. URI is a string with hostname and port number
separated by colon. Instead URI user can pass a port as a number, but
memcached doesn't expect it and fails with exception. Patch fixes it by
adding conversion of uri to a string.

Fixes #107
@Totktonada
Copy link
Member

What is interesing:

Tarantool 2.10.0-beta2-134-gdadb8d70b
type 'help' for interactive help
tarantool> uri = require('uri')
---
...

tarantool> uri.parse(3301)
---
- service: '3301'
...
Tarantool 1.10.12-39-gf83be3f9d
type 'help' for interactive help
tarantool> uri = require('uri')
---
...

tarantool> uri.parse(3301)
---
- error: 'builtin/uri.lua:46: bad argument #2 to ''uri_parse'' (cannot convert ''number''
    to ''const char *'')'
...

I guess recent patches around multiple listening sockets for iproto affected this behaviour.

ligurio added a commit that referenced this issue Mar 3, 2022
For creating memcached instance module requires instance name, URI and
table with options. URI is a string with hostname and port number
separated by colon. Instead URI user can pass a port as a number, but
memcached doesn't expect it and fails with exception. Patch fixes it by
adding conversion of uri to a string.

Fixes #107
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants