fagnercarvalho opened a new issue #2159:
URL: https://github.com/apache/iotdb/issues/2159


   In the past few days I have been trying to connect to the Thrift endpoints 
but my call to `OpenSession` is hanging.
   
   At first I thought it could be something with Windows (I'm using Docker but 
I'm connecting from a Windows machine) and then I used Ubuntu but got the same 
issue.
   
   Then I thought it could be Go and I tried using Python but it is hanging too.
   
   Here is the command I used to start iotdb:
   ```
   docker run -d -p 6667:6667 -p 31999:31999 -p 8181:8181 --name some-iotdb 
apache/iotdb:latest
   ```
   
   And here is the Python code:
   
   ```python
   from iotdb.Session import Session
   
   ip = "0.0.0.0"
   port_ = "6667"
   username_ = 'root'
   password_ = 'root'
   session = Session(ip, port_, username_, password_)
   session.open(False)
   zone = session.get_time_zone()
   print(zone)
   session.close()
   ```
   
   And here is the Go code:
   ```go
   package iotdb
   
   import (
        "context"
        "github.com/apache/thrift/lib/go/thrift"
        "github.com/fagnercarvalho/iotdb-client-go/thrift/rpc"
   )
   
   type Client interface {
        SetStorageGroup(name string) error
   }
   
   type clientImpl struct {
        sessionId *int64
        rpcServer *rpc.TSIServiceClient
   }
   
   func (c clientImpl) SetStorageGroup(name string) error {
        _, err := c.rpcServer.SetStorageGroup(context.Background(), 
*c.sessionId, name)
        if err != nil {
                return err
        }
   
        return nil
   }
   
   const protocolVersion  = rpc.TSProtocolVersion_IOTDB_SERVICE_PROTOCOL_V3
   
   func newClient(username string, password string, addr string) 
(*rpc.TSIServiceClient, int64, error) {
        var protocolFactory thrift.TProtocolFactory
        var trans thrift.TTransport
        trans, err := thrift.NewTSocketTimeout(addr, 0)
        if err != nil {
                return nil, -1, err
        }
   
        trans = thrift.NewTFramedTransport(trans)
        if !trans.IsOpen() {
                err = trans.Open()
                if err != nil {
                        return nil, -1, err
                }
        }
        protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
        iProtocol := protocolFactory.GetProtocol(trans)
        oProtocol := protocolFactory.GetProtocol(trans)
        client := rpc.NewTSIServiceClient(thrift.NewTStandardClient(iProtocol, 
oProtocol))
        tSOpenSessionReq := rpc.TSOpenSessionReq{ClientProtocol: 
protocolVersion, ZoneId: "Asia/Shanghai", Username: &username,
                Password: &password}
        ctx, cancel := context.WithDeadline(context.Background(), 
time.Now().Add(time.Second * 30))
        tSOpenSessionResp, err := client.OpenSession(ctx, &tSOpenSessionReq)
        if err != nil {
                return nil, -1, err
        }
   
        defer cancel()
   
        return client, tSOpenSessionResp.GetSessionId(), nil
   }
   
   func NewClient(username string, password string) (Client, error) {
        rpcServer, sessionId, err := newClient(username, 
password,"127.0.0.1:6667")
        if err != nil {
                return nil, err
        }
   
        client := clientImpl{
                rpcServer: rpcServer,
                sessionId: &sessionId,
        }
   
        return client, nil
   }
   ```
   
   ```go
   package iotdb
   
   import (
        "fmt"
        "testing"
   )
   
   func TestSetStorageGroup(t *testing.T) {
        client, err := NewClient("root", "root")
        if err != nil {
                t.Fatal(fmt.Sprintf("error when initiating client: %v", err))
        }
   
        err = client.SetStorageGroup("root.test")
        if err != nil {
                t.Fatal(fmt.Sprintf("error when adding storage group: %v", err))
        }
   }
   ```
   
   I also tried using a iotdb Go client I found but it is hanging too 
(https://github.com/manlge/go-iotdb).
   
   What am I doing wrong?
   
   Here are logs from the Docker container (not much to see here I suppose):
   
   ```
   ---------------------
   
   Starting IoTDB
   
   ---------------------
   
   setting local JMX...
   
   Maximum memory allocation pool = 3169MB, initial memory allocation pool = 
792MB
   
   If you want to change this configuration, please check 
conf/iotdb-env.sh(Unix or OS X, if you use Windows, check conf/iotdb-env.bat).
   
   SLF4J: Class path contains multiple SLF4J bindings.
   
   SLF4J: Found binding in 
[jar:file:/iotdb/lib/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
   
   SLF4J: Found binding in 
[jar:file:/iotdb/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
   
   SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an 
explanation.
   
   SLF4J: Actual binding is of type 
[ch.qos.logback.classic.util.ContextSelectorStaticBinder]
   
   2020-12-02 02:01:06,324 [main] INFO 
org.apache.iotdb.db.conf.IoTDBDescriptor:130 - Start to read config file 
/iotdb/sbin/../conf/iotdb-engine.properties
   
   2020-12-02 02:01:06,343 [main] INFO 
org.apache.iotdb.db.conf.IoTDBDescriptor:149 - The stat_monitor_detect_freq_sec 
value is smaller than default, use default value
   
   2020-12-02 02:01:06,344 [main] INFO 
org.apache.iotdb.db.conf.IoTDBDescriptor:156 - The 
stat_monitor_retain_interval_sec value is smaller than default, use default 
value
   
   2020-12-02 02:01:06,344 [main] INFO 
org.apache.iotdb.db.conf.IoTDBDescriptor:645 - allocateMemoryForRead = 997195776
   
   2020-12-02 02:01:06,345 [main] INFO 
org.apache.iotdb.db.conf.IoTDBDescriptor:646 - allocateMemoryForWrite = 
1994391552
   
   2020-12-02 02:01:06,355 [main] INFO 
org.apache.iotdb.db.conf.IoTDBDescriptor:283 - Time zone has been set to +08:00
   
   2020-12-02 02:01:06,365 [main] INFO 
org.apache.iotdb.tsfile.common.conf.TSFileDescriptor:108 - Start to read config 
file /iotdb/sbin/../conf/iotdb-engine.properties
   
   2020-12-02 02:01:06,374 [main] INFO 
org.apache.iotdb.db.conf.IoTDBConfigCheck:93 - Starting IoTDB 0.10.1
   
   2020-12-02 02:01:06,375 [main] INFO 
org.apache.iotdb.db.conf.IoTDBConfigCheck:102 - 
/iotdb/sbin/../data/system/schema dir has been created.
   
   2020-12-02 02:01:06,376 [main] INFO 
org.apache.iotdb.db.conf.IoTDBConfigCheck:154 - 
/iotdb/sbin/../data/system/schema/system.properties has been created.
   
   2020-12-02 02:01:06,396 [main] WARN 
org.apache.iotdb.db.service.StartupChecks:36 - iotdb.jmx.port missing from 
iotdb-env.sh(Unix or OS X, if you use Windows, check conf/iotdb-env.bat)
   
   2020-12-02 02:01:06,398 [main] INFO 
org.apache.iotdb.db.service.StartupChecks:52 - JDK veriosn is 11.
   
   2020-12-02 02:01:06,399 [main] INFO org.apache.iotdb.db.service.IoTDB:88 - 
Setting up IoTDB...
   
   2020-12-02 02:01:06,428 [main] INFO org.apache.iotdb.db.service.IoTDB:136 - 
After initializing, max memTable num is 20, tsFile threshold is 536870912, 
memtableSize is 1073741824
   
   2020-12-02 02:01:06,430 [main] WARN 
org.apache.iotdb.db.service.JMXService:88 - JMX ServerService JMX port is 
undefined
   
   2020-12-02 02:01:06,434 [main] INFO 
org.apache.iotdb.db.concurrent.IoTDBThreadPoolFactory:46 - new fixed thread 
pool: Flush-ServerServiceImpl, thread number: 8
   
   2020-12-02 02:01:06,435 [main] INFO 
org.apache.iotdb.db.concurrent.IoTDBThreadPoolFactory:80 - new cached thread 
pool: Flush-SubTask-ServerServiceImpl
   
   2020-12-02 02:01:06,436 [main] INFO 
org.apache.iotdb.db.engine.flush.pool.FlushSubTaskPoolManager:57 - Flush sub 
task manager started.
   
   2020-12-02 02:01:06,436 [main] INFO 
org.apache.iotdb.db.engine.flush.pool.FlushTaskPoolManager:58 - Flush task 
manager started.
   
   2020-12-02 02:01:06,445 [main] INFO 
org.apache.iotdb.db.cost.statistic.Measurement:143 - start measurement stats 
module...
   
   2020-12-02 02:01:06,445 [main] INFO 
org.apache.iotdb.db.cost.statistic.Measurement:251 - start the consuming task 
in the measurement stats module...
   
   2020-12-02 02:01:06,447 [main] INFO 
org.apache.iotdb.db.conf.adapter.ManageDynamicParameters:109 - IoTDB: start 
Manage Dynamic Parameters...
   
   2020-12-02 02:01:06,456 [main] INFO 
org.apache.iotdb.db.concurrent.IoTDBThreadPoolFactory:46 - new fixed thread 
pool: Recovery-Thread-Pool, thread number: 8
   
   2020-12-02 02:01:06,491 [main] INFO 
org.apache.iotdb.db.service.UpgradeSevice:112 - finish counting upgrading 
files, total num:0
   
   2020-12-02 02:01:06,492 [main] INFO 
org.apache.iotdb.db.service.UpgradeSevice:73 - Waiting for upgrade task pool to 
shut down
   
   2020-12-02 02:01:06,492 [main] INFO 
org.apache.iotdb.db.service.UpgradeSevice:78 - Upgrade service stopped
   
   2020-12-02 02:01:06,493 [main] INFO 
org.apache.iotdb.db.engine.merge.manage.MergeManager:94 - MergeManager started
   
   2020-12-02 02:01:06,496 [main] INFO 
org.apache.iotdb.db.service.RPCService:119 - IoTDB: start RPC ServerService...
   
   2020-12-02 02:01:06,584 [main] INFO 
org.apache.iotdb.db.auth.authorizer.BasicAuthorizer$InstanceHolder:85 - 
Authorizer provider class: 
org.apache.iotdb.db.auth.authorizer.LocalFileAuthorizer
   
   2020-12-02 02:01:06,586 [main] INFO 
org.apache.iotdb.db.auth.user.LocalFileUserAccessor:217 - user info dir 
/iotdb/sbin/../data/system/users is created
   
   2020-12-02 02:01:06,626 [main] INFO 
org.apache.iotdb.db.auth.user.BasicUserManager:78 - Admin initialized
   
   2020-12-02 02:01:06,628 [main] INFO 
org.apache.iotdb.db.auth.user.BasicUserManager:78 - Admin initialized
   
   2020-12-02 02:01:06,629 [main] INFO 
org.apache.iotdb.db.auth.role.LocalFileRoleAccessor:168 - role info dir 
/iotdb/sbin/../data/system/roles is created
   
   2020-12-02 02:01:06,629 [main] INFO 
org.apache.iotdb.db.auth.authorizer.BasicAuthorizer:65 - Initialization of 
Authorizer completes
   
   2020-12-02 02:01:06,661 [RPC-ServerServiceImpl] INFO 
org.apache.iotdb.db.service.RPCService$RPCServiceThread:202 - The RPC service 
thread begin to run...
   
   2020-12-02 02:01:06,762 [main] INFO 
org.apache.iotdb.db.service.RPCService:135 - IoTDB: start RPC ServerService 
successfully, listening on ip 0.0.0.0 port 6667
   
   2020-12-02 02:01:06,763 [main] INFO org.apache.iotdb.db.service.IoTDB:123 - 
IoTDB is set up.
   
   2020-12-02 02:01:06,764 [main] INFO org.apache.iotdb.db.service.IoTDB:84 - 
IoTDB has started.
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to