You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/09/01 06:06:17 UTC

[GitHub] [apisix] mangoGoForward opened a new pull request #4956: fix:Integration of eureka as discovery registry fail

mangoGoForward opened a new pull request #4956:
URL: https://github.com/apache/apisix/pull/4956


   I start eureka server on tomcat, and then start apisix, I found some error logs like this:
   `2021/08/30 10:33:22 [error] 6232#3458399: *14278 [lua] eureka.lua:197: invalid response body: �����������Sێ�0����G����򴔠 ��EKQ�� M큸8vd;l����qBv�jժU��Ϝ9�9s�� ϕ��юM�� ��߻�@�MY���E��\ʍ@ n׻xW'�r6���4d!��>.�f���y���dsX �hY��)����4��amM��E��q~U�� J���τ���Qԥ'L@�}᪛��ИV �z��_ݭ���(����-6�w��6�E ���[{[ ;�������9����{P�BrSho�0s�f�<�Q{�K�7���+p���d�F�W�gD�I�G�F1:���C�|rM�n4�/��t���6��5>�Z��)�7ȩ[��������&��x�����2Cj����M������ͤ7����cM��4�ތF����$���n��R�����xB�d�!�u%��8ATx���Q +j�Zd�/�!�s�h��)�k^����p��U�O�ϧ���MU-��b��)����
 ��#(��S����Ky(%�Sml��@������&���s�����+����C"��N/7$:�ƾ���9I��5��-_���|�4���竗\�A�Y�,�v�F���ĵk�\��� err: Expected value but found invalid token at character 1, context: ngx.timer`
   
   Tomcat server.xml:
   ```
   <Connector port="8080" protocol="HTTP/1.1"
                  connectionTimeout="20000"
                  redirectPort="8443" URIEncoding="UTF-8" />
   ```
   
   I print response headers, and noticed that the "Content-Encoding" of header is gzip, means that eureka server returned data is compressed. 
   so when eureka server return compressed data, I use lua-zlib to unzip received response data
   
   ### What this PR does / why we need it:
   <!--- Why is this change required? What problem does it solve? -->
   <!--- If it fixes an open issue, please link to the issue here. -->[#4929](https://github.com/apache/apisix/issues/4929)
   
   ### Pre-submission checklist:
   
   * [ ] Did you explain what problem does this PR solve? Or what new features have been added?
   * [ ] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
   


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] tzssangglass commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-911651566


   > And sorry that I don't know how to create a test case, which can configure the eureka to let it both return gzip response and uncompresed response to test if logic
   
   according to this document: https://github.com/Netflix/eureka/wiki/Example-Custom-ReadOnly-client, is it possible to specify Accept-Encoding in the header to control this?
   


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] mangoGoForward closed pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
mangoGoForward closed pull request #4956:
URL: https://github.com/apache/apisix/pull/4956


   


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] spacewander commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
spacewander commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-910080063


   I mean a way to test it in CI


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] mangoGoForward commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
mangoGoForward commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-911069362


   > Before taking care of the Chaos test, please add some tests to verify it.
   
   OK


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] spacewander commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
spacewander commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-910080063


   I mean a way to test it in CI


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] imjoey commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
imjoey commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-909989460


   @mangoGoForward CI running on CentOS 7 seems failed due to the missing dependences of `zlib` and `zlib-devel`. Could you please add installing these two packages within https://github.com/apache/apisix/blob/master/ci/centos7-ci.sh#L30? Thanks.


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] spacewander commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
spacewander commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-912215709


   > 
   > 
   > > I have ever met some strange situations when I deploy an Eureka service, it doesn't respect the `Accpet-Encoding` header, compressed data is sent all the time.
   > > And, I want to know the handle about the `Accept-Encoding` in the current APISIX implementation. We may still have to decode the compressed data.
   > 
   > Compressed data is send depend on server, no matter client request of `Accpet-Encoding` header. Add a "if" logic can to process compressed data, and no effect on existing logic. what's your opinion? @tokers @tzssangglass
   
   So there is an option to enable compression in Eureka? The Eureka used in the CI doesn't send compression data by default. Maybe @mangoGoForward you can figure out why Eureka will send compression data even the client doesn't send the `Accpet-Encoding` header.


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] mangoGoForward commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
mangoGoForward commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-911005974


   CI running on Chaos Test failed, and I got this error:
   ```
   Error: Failed installing dependency: https://luarocks.org/lua-zlib-1.2-1.rockspec - Could not find header file for ZLIB
     No file zlib.h in /usr/local/include
     No file zlib.h in /usr/include
     No file zlib.h in /include
   You may have to install ZLIB in your system and/or pass ZLIB_DIR or ZLIB_INCDIR to the luarocks command.
   Example: luarocks install lua-zlib ZLIB_DIR=/usr/local
   make: *** [Makefile:88: deps] Error 1
   The command '/bin/sh -c set -x     && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' /etc/apk/repositories)     && apk add --no-cache --virtual .builddeps     automake     autoconf     libtool     pkgconfig     cmake     git     pcre     pcre-dev     && cd apisix     && make deps     && cp -v bin/apisix /usr/bin/     && mv ../apisix /usr/local/apisix     && apk del .builddeps build-base make unzip' returned a non-zero code: 2
   ```
   
   Where can I specify to install zlib and zlib-devel, @imjoey 


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] tokers commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
tokers commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-912169821


   > > according to this document: https://github.com/Netflix/eureka/wiki/Example-Custom-ReadOnly-client, is it possible to specify Accept-Encoding in the header to control this?
   > 
   > It seems like this PR is unnecessary, and my confusion is resolved mentioned on #4929 when I run eureka server via docker, also can specify "Accept-Encoding" of header to get compressed or uncompressed response. could I close this PR and issues ? And I will try to find out why got compressed response when start eureka server within Tomcat
   
   I have ever met some strange situations when I deploy an Eureka service, it doesn't respect the `Accpet-Encoding` header, compressed data is sent all the time.
   
   And, I want to know the handle about the `Accept-Encoding` in the current APISIX implementation. We may still have to decode the compressed data.


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] mangoGoForward commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
mangoGoForward commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-910999807


   > I mean a way to test it in CI
   
   There are some test case within https://github.com/apache/apisix/blob/master/t/discovery/eureka.t, I will push later when after run test case successful


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] mangoGoForward commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
mangoGoForward commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-911766203


   > according to this document: https://github.com/Netflix/eureka/wiki/Example-Custom-ReadOnly-client, is it possible to specify Accept-Encoding in the header to control this?
   
   It seems like this PR is unnecessary, and my confusion is resolved mentioned on #4929 when I run eureka server via docker, also can specify "Accept-Encoding" of header to get compressed or uncompressed response. could I close this PR and issues ? And I will try to find out why got compressed response when start eureka server within Tomcat


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] mangoGoForward commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
mangoGoForward commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-911301560


   > Good. I guess you can configure the eureka to let it always return gzip response?
   > https://github.com/apache/apisix/blob/991d093c4c23a8f2dd3b978c8e040340cd25efd3/ci/install-ext-services-via-docker.sh#L29
   > 
   > If you have trouble creating a test case, please let us know.
    
   I introduce the design ideas, When I run the eureka with Tomcat server which use source code to build by gradle, and I got some error logs after start apisix, because eureka returned gzip response, So I added a judgment logic:
   ```
   local encoding = res.headers["Content-Encoding"]
       local res_body = res.body
       if encoding == 'gzip' then
           local stream = zlib.inflate()
           res_body = stream(res_body)
       end
   ```
   It will use lua-zlib to unzip when get a gzip response.
   
   And sorry that I don't know how to create a test case, which can configure the eureka to let it both return gzip response and uncompresed response to test if logic


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] spacewander commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
spacewander commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-911112833


   Good. I guess you can configure the eureka to let it always return gzip response?
   https://github.com/apache/apisix/blob/991d093c4c23a8f2dd3b978c8e040340cd25efd3/ci/install-ext-services-via-docker.sh#L29
   
   If you have trouble creating a test case, please let us know.


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] imjoey commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
imjoey commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-909989460


   @mangoGoForward CI running on CentOS 7 seems failed due to the missing dependences of `zlib` and `zlib-devel`. Could you please add installing these two packages within https://github.com/apache/apisix/blob/master/ci/centos7-ci.sh#L30? Thanks.


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] mangoGoForward commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
mangoGoForward commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-912188605


   > I have ever met some strange situations when I deploy an Eureka service, it doesn't respect the `Accpet-Encoding` header, compressed data is sent all the time.
   > 
   > And, I want to know the handle about the `Accept-Encoding` in the current APISIX implementation. We may still have to decode the compressed data.
   
   Compressed data is send depend on server, no matter client request of `Accpet-Encoding` header. Add a "if" logic can to process compressed data, and no effect on existing logic. what's your opinion? @tokers @tzssangglass 


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] mangoGoForward commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
mangoGoForward commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-910034562


   > Could we find a way to test for it?
   
   @spacewander May you can follow this guidance[Integration service discovery registry](https://apisix.apache.org/docs/apisix/discovery#supported-discovery-registries). Run eureka server in local, and config discovery.eureka.host, I run eureka server on tomcat, and port is 8080, so I change host to 127.0.0.1:8080, Then start apisix, use embedded control api for debugging supported by https://github.com/apache/apisix/blob/b7c1b5e8ce91323b14f80db8bdb4b63ca37bd6ef/apisix/discovery/eureka.lua#L255
   ```
   curl http://127.0.0.1:9090/v1/discovery/eureka/dump
   {"services":{"EUREKA":[{"host":"127.0.0.1","metadata":{"@class":"java.util.Collections$EmptyMap"},"weight":100,"port":8080}]},"config":{"weight":100,"prefix":"\/eureka\/v2\/","host":["http:\/\/127.0.0.1:8080"],"fetch_interval":30,"timeout":{"send":2000,"connect":2000,"read":5000}}}
   ```
   
   We can see that Eureka's instance data convert to APISIX's node


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] mangoGoForward commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
mangoGoForward commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-910024222


   > @mangoGoForward CI running on CentOS 7 seems failed due to the missing dependences of `zlib` and `zlib-devel`. Could you please add installing these two packages within https://github.com/apache/apisix/blob/master/ci/centos7-ci.sh#L30? Thanks.
   
   OK, Already add these two packages @imjoey 


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] mangoGoForward commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
mangoGoForward commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-910024222






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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] tzssangglass commented on pull request #4956: fix: Integration of eureka as discovery registry fail

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on pull request #4956:
URL: https://github.com/apache/apisix/pull/4956#issuecomment-911896325


   yes, feel free to reopen this if you need.


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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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