question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Calls to RPC service hanging

See original GitHub issue

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:

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:

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
}
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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
yanhongwanggcommented, Dec 2, 2020

Hi, according to the above version problem, I just tried the 0.11 branch code, which is available. In addition, you can try this go client https://github.com/yanhongwangg/incubator-iotdb/tree/client-go/client-go, it can work well,just go get github.com/yanhongwangg/incubator-iotdb@client-go

1reaction
qiaojialincommented, Dec 2, 2020

Besides, For each version IoTDB (0.8, 0.9, 0.10, 0.11), the rpc is not compatible. Please use the client whose version is the same as the server (0.x)

The master branch is the develop branch. Each major version has a release branch: rel/0.11, rel/0.10, rel/0.9 …

Read more comments on GitHub >

github_iconTop Results From Across the Web

Preventing Client-side Hangs - Win32 apps | Microsoft Learn
There are two ways your client can hang: network connectivity can cause server requests to become lost, or the server itself can crash....
Read more >
RPC hangs Windows? - Super User
I have no way to test if the issue is solved, the hang uccurs "randomly". Is there any way to find, which process...
Read more >
RPC call on client hangs even with deadline when the service ...
The RPC should return after the deadline expires, if the service is not reachable or not running. What did you see instead? The...
Read more >
How to Fix "The RPC Server is Unavailable" Error in Windows
A complete guide to help you tackle your "RPC server is unavailable" error and get your computer back to normal. Learn more now!...
Read more >
XML RPC Server hangs on sixth call - webMethods
The changes to our objects allow for five successful calls, but upon making the sixth call, the XML RPC Server hangs, which is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found