madeindra / signal-setup-guide

Setup guide for Signal (OpenWhisper) server & client. Please refer to the discussion section for questions & difficulties.
MIT License
157 stars 94 forks source link

Replication server cause error #1

Closed andy840119 closed 4 years ago

andy840119 commented 4 years ago

After run up the server, server will try to call replication's server path /v2/directory/reconcile. But this path is not exist in code. . Full log :

0:0:0:0:0:0:0:1 - - [09/3月/2020:09:36:31 +0000] "GET /v2/directory/reconcile HTTP/1.1" 404 43 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36" 14
0:0:0:0:0:0:0:1 - - [09/3月/2020:09:36:31 +0000] "GET /favicon.ico HTTP/1.1" 404 43 "http://localhost:8080/v2/directory/reconcile" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36" 2
WARN  [2020-03-09 09:36:38,554] org.whispersystems.textsecuregcm.storage.DirectoryReconciler: request error: 
! java.net.ConnectException: Connection refused: connect
! at java.base/java.net.PlainSocketImpl.connect0(Native Method)
! at java.base/java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:101)
! at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
! at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
! at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
! at java.base/java.net.Socket.connect(Socket.java:591)
! at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177)
! at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)
! at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)
! at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
! at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:341)
! at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:362)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1248)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1187)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1015)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1362)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1337)
! at org.glassfish.jersey.client.internal.HttpUrlConnector$4.getOutputStream(HttpUrlConnector.java:390)
! at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:200)
! at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:194)
! at org.glassfish.jersey.message.internal.CommittingOutputStream.write(CommittingOutputStream.java:228)
! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$UnCloseableOutputStream.write(WriterInterceptorExecutor.java:299)
! at com.fasterxml.jackson.core.json.UTF8JsonGenerator._flushBuffer(UTF8JsonGenerator.java:2085)
! at com.fasterxml.jackson.core.json.UTF8JsonGenerator.flush(UTF8JsonGenerator.java:1097)
! at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:915)
! at com.fasterxml.jackson.jaxrs.base.ProviderBase.writeTo(ProviderBase.java:625)
! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)
! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250)
! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
! at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130)
! at org.glassfish.jersey.client.ClientRequest.doWriteEntity(ClientRequest.java:517)
! at org.glassfish.jersey.client.ClientRequest.writeEntity(ClientRequest.java:499)
! at org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:393)
! at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:285)
! ... 17 common frames omitted
! Causing: javax.ws.rs.ProcessingException: java.net.ConnectException: Connection refused: connect
! at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:287)
! at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:252)
! at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:701)
! at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
! at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
! at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
! at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:444)
! at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:697)
! at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:448)
! at org.glassfish.jersey.client.JerseyInvocation$Builder.put(JerseyInvocation.java:332)
! at org.whispersystems.textsecuregcm.storage.DirectoryReconciliationClient.sendChunk(DirectoryReconciliationClient.java:56)
! at org.whispersystems.textsecuregcm.storage.DirectoryReconciler.sendChunk(DirectoryReconciler.java:119)
! at org.whispersystems.textsecuregcm.storage.DirectoryReconciler.onCrawlChunk(DirectoryReconciler.java:74)
! at org.whispersystems.textsecuregcm.storage.AccountDatabaseCrawlerListener.timeAndProcessCrawlChunk(AccountDatabaseCrawlerListener.java:48)
! at org.whispersystems.textsecuregcm.storage.AccountDatabaseCrawler.processChunk(AccountDatabaseCrawler.java:140)
! at org.whispersystems.textsecuregcm.storage.AccountDatabaseCrawler.doPeriodicWork(AccountDatabaseCrawler.java:110)
! at org.whispersystems.textsecuregcm.storage.AccountDatabaseCrawler.run(AccountDatabaseCrawler.java:91)
! at java.base/java.lang.Thread.run(Thread.java:834)
WARN  [2020-03-09 09:36:38,554] org.whispersystems.textsecuregcm.storage.AccountDatabaseCrawler: error in database crawl: 
! java.net.ConnectException: Connection refused: connect
! at java.base/java.net.PlainSocketImpl.connect0(Native Method)
! at java.base/java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:101)
! at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
! at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
! at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
! at java.base/java.net.Socket.connect(Socket.java:591)
! at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177)
! at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)
! at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)
! at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
! at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:341)
! at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:362)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1248)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1187)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1015)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1362)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1337)
! at org.glassfish.jersey.client.internal.HttpUrlConnector$4.getOutputStream(HttpUrlConnector.java:390)
! at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:200)
! at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:194)
! at org.glassfish.jersey.message.internal.CommittingOutputStream.write(CommittingOutputStream.java:228)
! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$UnCloseableOutputStream.write(WriterInterceptorExecutor.java:299)
! at com.fasterxml.jackson.core.json.UTF8JsonGenerator._flushBuffer(UTF8JsonGenerator.java:2085)
! at com.fasterxml.jackson.core.json.UTF8JsonGenerator.flush(UTF8JsonGenerator.java:1097)
! at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:915)
! at com.fasterxml.jackson.jaxrs.base.ProviderBase.writeTo(ProviderBase.java:625)
! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)
! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250)
! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
! at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130)
! at org.glassfish.jersey.client.ClientRequest.doWriteEntity(ClientRequest.java:517)
! at org.glassfish.jersey.client.ClientRequest.writeEntity(ClientRequest.java:499)
! at org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:393)
! at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:285)
! ... 17 common frames omitted
! Causing: javax.ws.rs.ProcessingException: java.net.ConnectException: Connection refused: connect
! at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:287)
! at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:252)
! at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:701)
! at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
! at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
! at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
! at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:444)
! at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:697)
! at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:448)
! at org.glassfish.jersey.client.JerseyInvocation$Builder.put(JerseyInvocation.java:332)
! at org.whispersystems.textsecuregcm.storage.DirectoryReconciliationClient.sendChunk(DirectoryReconciliationClient.java:56)
! at org.whispersystems.textsecuregcm.storage.DirectoryReconciler.sendChunk(DirectoryReconciler.java:119)
! ... 6 common frames omitted
! Causing: javax.ws.rs.ProcessingException: javax.ws.rs.ProcessingException: java.net.ConnectException: Connection refused: connect
! at org.whispersystems.textsecuregcm.storage.DirectoryReconciler.sendChunk(DirectoryReconciler.java:128)
! at org.whispersystems.textsecuregcm.storage.DirectoryReconciler.onCrawlChunk(DirectoryReconciler.java:74)
! at org.whispersystems.textsecuregcm.storage.AccountDatabaseCrawlerListener.timeAndProcessCrawlChunk(AccountDatabaseCrawlerListener.java:48)
! at org.whispersystems.textsecuregcm.storage.AccountDatabaseCrawler.processChunk(AccountDatabaseCrawler.java:140)
! at org.whispersystems.textsecuregcm.storage.AccountDatabaseCrawler.doPeriodicWork(AccountDatabaseCrawler.java:110)
! at org.whispersystems.textsecuregcm.storage.AccountDatabaseCrawler.run(AccountDatabaseCrawler.java:91)
! at java.base/java.lang.Thread.run(Thread.java:834)
WARN  [2020-03-09 09:36:50,561] org.whispersystems.textsecuregcm.storage.DirectoryReconciler: request error: 
! java.net.ConnectException: Connection refused: connect
! at java.base/java.net.PlainSocketImpl.connect0(Native Method)
! at java.base/java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:101)
! at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
! at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
! at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
! at java.base/java.net.Socket.connect(Socket.java:591)
! at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177)
! at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)
! at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)
! at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
! at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:341)
! at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:362)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1248)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1187)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1015)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1362)
! at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1337)
! at org.glassfish.jersey.client.internal.HttpUrlConnector$4.getOutputStream(HttpUrlConnector.java:390)
! at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:200)
! at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:194)
! at org.glassfish.jersey.message.internal.CommittingOutputStream.write(CommittingOutputStream.java:228)
! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$UnCloseableOutputStream.write(WriterInterceptorExecutor.java:299)
! at com.fasterxml.jackson.core.json.UTF8JsonGenerator._flushBuffer(UTF8JsonGenerator.java:2085)
! at com.fasterxml.jackson.core.json.UTF8JsonGenerator.flush(UTF8JsonGenerator.java:1097)
! at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:915)
! at com.fasterxml.jackson.jaxrs.base.ProviderBase.writeTo(ProviderBase.java:625)
! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)
! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250)
! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
! at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130)
! at org.glassfish.jersey.client.ClientRequest.doWriteEntity(ClientRequest.java:517)
! at org.glassfish.jersey.client.ClientRequest.writeEntity(ClientRequest.java:499)
! at org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:393)
! at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:285)
! ... 17 common frames omitted
! Causing: javax.ws.rs.ProcessingException: java.net.ConnectException: Connection refused: connect
! at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:287)
! at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:252)
! at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:701)
! at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
! at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
! at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
! at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:444)
! at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:697)
! at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:448)
! at org.glassfish.jersey.client.JerseyInvocation$Builder.put(JerseyInvocation.java:332)
! at org.whispersystems.textsecuregcm.storage.DirectoryReconciliationClient.sendChunk(DirectoryReconciliationClient.java:56)
! at org.whispersystems.textsecuregcm.storage.DirectoryReconciler.sendChunk(DirectoryReconciler.java:119)
! at org.whispersystems.textsecuregcm.storage.DirectoryReconciler.onCrawlChunk(DirectoryReconciler.java:74)
! at org.whispersystems.textsecuregcm.storage.AccountDatabaseCrawlerListener.timeAndProcessCrawlChunk(AccountDatabaseCrawlerListener.java:48)
! at org.whispersystems.textsecuregcm.storage.AccountDatabaseCrawler.processChunk(AccountDatabaseCrawler.java:140)
! at org.whispersystems.textsecuregcm.storage.AccountDatabaseCrawler.doPeriodicWork(AccountDatabaseCrawler.java:110)
! at org.whispersystems.textsecuregcm.storage.AccountDatabaseCrawler.run(AccountDatabaseCrawler.java:91)
! at java.base/java.lang.Thread.run(Thread.java:834)
WARN  [2020-03-09 09:36:50,562] org.whispersystems.textsecuregc
madeindra commented 4 years ago

Hey @andy840119, please give me more detail about what is your objective and what modification did you do? Also about the server & client version you used.

andy840119 commented 4 years ago

Server : 2.92 Android : 4.53 . I only set up twilio, gcm(fcm), redis and postgresql in my signal server. Android can only send few message, then this error happen. . Also can i ask what directory property do in config.yml? Thanks a lot 👍

madeindra commented 4 years ago

I will give you an example.

directory:
  redis: # Redis server configuration for directory cluster
    url: redis://127.0.0.1:6379/directory
    replicaUrls:
      -  redis://127.0.0.1:6379/directoryReplica
  client: # Configuration for interfacing with Contact Discovery Service cluster
    userAuthenticationTokenSharedSecret: b46dca6e16b48551a28dd6e4e28ed704 # head -c 16 /dev/urandom | hexdump -ve '1/1 "%.2x"'
    userAuthenticationTokenUserIdSecret: 0815943b625ca1ccbf08a02acd2e930f # head -c 16 /dev/urandom | hexdump -ve '1/1 "%.2x"'
  sqs:
    accessKey:    CHANGE-TO-YOU-ACCESS-KEY
    accessSecret: CHANGE-TO-YOU-SECRET
    queueUrl:     https://sqs.us-east-1.amazonaws.com/1234567/your-queue-name.fifo
  server:
    replicationUrl: http://127.0.0.1:9090 # CDS replication endpoint base url
    replicationPassword:      mypassword # CDS replication endpoint password
    replicationCaCertificate: |
      -----BEGIN CERTIFICATE-----
      ...use-your-tls-certificate...
      -----END CERTIFICATE-----
madeindra commented 4 years ago

Also, check this: https://github.com/indrawp/Setup-Guide/blob/master/signal-server.md#faq

Try disabling accountDatabaseCrawler() in WhisperServerService.java first if you have not setup your CDSServer (or if you don't use CDS, because it is optional)

andy840119 commented 4 years ago

Thanks a lot! Can i ask which of the version of server and android client are you using?

madeindra commented 4 years ago

I use the same version Server 2.92 and Android 4.53.

Directory is used for CDS, so if you don't plan to use it you can disable it for now. But remember to always use a valid configuration because it is parsed & validated on runtime.

andy840119 commented 4 years ago

Have you meet that sometimes one phone(#1) can send message to another(#2), but another(#2) cannot send to this phone(#1). Or cannot send sticker. Thanks.

madeindra commented 4 years ago

Yes! It is caused by "UNIDENTIFIED_SENDER_TRUST_ROOT" in Android. Check this: https://github.com/indrawp/Setup-Guide/blob/master/signal-android.md#how-to

Make sure you set "UNIDENTIFIED_SENDER_TRUST_ROOT" using the public key that used to generate "UnidentifiedDelivery" in server's config.yml.

Also, i have not tried sticker. But for attachment, you need some patching, I've written it all in my Signal Android guide.

madeindra commented 4 years ago

Hi @andy840119, if you have solved the problem please mark this as closed. If not, please give more detail about what's not working.

andy840119 commented 4 years ago

Haven't success yet ;_; I'll read all the document then try it again 👍

madeindra commented 4 years ago

I've check that Android Client never call /v2/directory/reconcile, it is exist in the Server but I too get 404. Don't worry, it is related to CDS so, you won't need that for now.