MiraiForum

    • Register
    • Login
    • Search
    • Popular
    • Recent
    • Unsolved
    • Tags
    • Groups
    • 友情链接

    Solved 阿里ecs问题导致无法正常访问腾讯的聊天资源服务器,疑似ip被屏蔽

    开发交流
    7
    56
    4666
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Orisland
      Orisland 摸鱼 last edited by Orisland

      求解原因,本地测试正常通过,但是服务器上会在读取图片时卡在BufferedImage,然后就没了,也没有抛异常也没有任何反应。a839cf43-e7b8-440a-b763-7bd11a7660fd-image.png

      根本读不上去,本地端测试没有任何问题,服务器所以图片一律失败,后续消息收发也是正常的,找不到原因,求解。

      System.out.println("图片开始处理!");
              String url = Image.Key.queryUrl(image);
              int[] rgb = new int[3];
              InputStream inputStream = null;
      
              boolean flag = true;
              int num = 0;
              do {
                  if (++num > 3){
                      throw new  IOException();
                  }
                  System.out.println("第"+num+"次尝试!");
                  try {
                      inputStream = new URL(url).openStream();
                      flag = false;
                  }catch (Exception e){
                      e.printStackTrace();
                  }
              }while (flag);
      
              System.out.println("图片input流获取完成!");
      
      //        assert inputStream != null : "错误,inputsteam为空!";
              BufferedImage bi = ImageIO.read(inputStream);
              System.out.println("图片已读取缓冲区。");
      
      1 Reply Last reply Reply Quote 0
      • Orisland
        Orisland 摸鱼 @Orisland last edited by Orisland

        @orisland 问题已解决,阿里不同意免费给我换ip,更换弹性ip我需要花费至少5倍到7倍于3年服务器的总价格来进行支付,讲道理我相当的生气。
        于是我想办法py了同学位于张家口的阿里云服务器进行了转发后,腾讯相关的资源访问功能得以正常实现,图片下载功能恢复正常,但是又由于此番走其他服务器中转途径,所以该访问速度受到ecs限制,所以被钉死在了1M带宽但是至少,能用了。
        故此贴终结。
        同时为大家踩雷,请勿选择深圳位置的阿里云服务器ecs,张家口是个很不错的选择,深圳已遇雷。
        4c8b212f-2680-47af-ae4b-f4530edbfd83-image.png
        614b2a32-6f79-4613-ad4a-fe5d77b819e0-image.png

        2021年07月24日14:26:20补充:
        修正,阿里的ecs无论在哪访问腾讯的服务器都不太稳定,张家口也只是相对来说较为稳定,所以不要对稳定性报太大希望。所以如果你的服务器真的始终或绝大部分情况下用来作为运行mirai的设备,那么我推荐你选择腾讯云(毕竟人家10分钟左右工单回复阿里一般单位是小时)。
        下图左侧深圳ecs,右侧张家口ecs,可以看到真的不稳……
        6118abc8-777e-40e2-a20c-4ce83ee2df93-image.png

        2021年07月26日10:14:19更新
        放弃吧你,阿里服务器是原罪。问题反复出现无法解决,目前已放弃采用阿里的服务器访问腾讯资源,目前只能尝试其他途径。

        2021年07月26日15:00:37
        可用方案,cloudflare,暂时解决问题,如有其他问题后续在补充。

        最后,阿里xxxxx,我xxxxxxxx,祝你xxxxxxx,希望你xxxxxxxxx

        1 Reply Last reply Reply Quote 1
        • cssxsh
          cssxsh last edited by

          下载太慢?

          Orisland 1 Reply Last reply Reply Quote 0
          • Orisland
            Orisland 摸鱼 @cssxsh last edited by

            @cssxsh 否,没有卡在下载,看控制台,这卡在了buffer,获取输入流阶段已经正常结束。

            cssxsh 1 Reply Last reply Reply Quote 0
            • cssxsh
              cssxsh @Orisland last edited by

              @orisland
              那只是建立了链接吧

              Orisland 1 Reply Last reply Reply Quote 0
              • Orisland
                Orisland 摸鱼 @cssxsh last edited by

                @cssxsh 啊这,那不应该啊,这图片连100kb都不到,是个表情包而已,1m的小水管按道理1秒也下完了。

                cssxsh 1 Reply Last reply Reply Quote 0
                • Orisland
                  Orisland 摸鱼 last edited by

                  麻了,找不出原因,下载按道理早就应该下完了,现在就是没有任何反应,总不至于腾讯屏蔽阿里云ecs的访问吧……

                  Orisland 1 Reply Last reply Reply Quote 0
                  • Orisland
                    Orisland 摸鱼 @Orisland last edited by

                    @orisland 如果有哪位佬知道一些解决方案求解啊……
                    (如何获取声望啊,不到3点60秒1贴……)

                    Nambers 1 Reply Last reply Reply Quote 0
                    • Nambers
                      Nambers 摸鱼 @Orisland last edited by

                      @orisland
                      https://mirai.mamoe.net/topic/51/发帖-互赞-刷声望
                      XD

                      1 Reply Last reply Reply Quote 0
                      • cssxsh
                        cssxsh @Orisland last edited by

                        @orisland
                        你先从input 获取bytes 再转成 image 分开来,才能知道哪一步出了问题

                        Orisland 1 Reply Last reply Reply Quote 0
                        • Orisland
                          Orisland 摸鱼 last edited by

                          @cssxsh 行,一会我改一下再找找问题。

                          1 Reply Last reply Reply Quote 0
                          • Orisland
                            Orisland 摸鱼 @cssxsh last edited by Orisland

                            @cssxsh aa7eb3bc-aa5b-47e6-a889-3b13c966caeb-image.png
                            好吧这么看似乎真的是没下载完(但是他也没下载完过啊,至少下载有个头啊,这一开始下载就没完没了了),但是这图片总共也就是一两百k啊=。=有什么好办法解决吗,除了升级ecs带宽外……

                            cssxsh 1 Reply Last reply Reply Quote 0
                            • cssxsh
                              cssxsh @Orisland last edited by

                              @orisland
                              用 okhttp , mirai 应该 自带这个 库的引用

                              Orisland 1 Reply Last reply Reply Quote 0
                              • cssxsh
                                cssxsh last edited by

                                帖子名字也该改了

                                Orisland 1 Reply Last reply Reply Quote 0
                                • Orisland
                                  Orisland 摸鱼 @cssxsh last edited by

                                  @cssxsh 帖子名字能改吗?我都没找到修改的选择项。

                                  cssxsh 1 Reply Last reply Reply Quote 0
                                  • cssxsh
                                    cssxsh @Orisland last edited by

                                    @orisland
                                    修改第一楼

                                    1 Reply Last reply Reply Quote 0
                                    • Orisland
                                      Orisland 摸鱼 @cssxsh last edited by

                                      @cssxsh 麻了,这个我不会用,我还是先去找找看吧。

                                      cssxsh 1 Reply Last reply Reply Quote 0
                                      • cssxsh
                                        cssxsh @Orisland last edited by

                                        @orisland fe69d386-a3b7-4cc6-aa53-d5fb83e6a02b-image.png

                                        Orisland 1 Reply Last reply Reply Quote 0
                                        • Orisland
                                          Orisland 摸鱼 @cssxsh last edited by

                                          @cssxsh 已改,我先去了解一下okhttp好了。。。

                                          1 Reply Last reply Reply Quote 0
                                          • cssxsh
                                            cssxsh last edited by

                                            最好是打印一下 图片的 url ,然后用 curl 之类的测试链接情况

                                            Orisland 2 Replies Last reply Reply Quote 0
                                            • Orisland
                                              Orisland 摸鱼 @cssxsh last edited by

                                              @cssxsh 似乎okhttp不太行,无论我请求什么都是null=。=,是我哪些参数写错了吗?

                                                      OkHttpClient okHttpClient = new OkHttpClient();
                                              
                                                      Request request = new Request.Builder()
                                                              .url("http://cdn.orisland.top/pic/2018/66606021.jpg")
                                                              .build();
                                                      
                                                      okHttpClient.newCall(request).enqueue(new Callback() {
                                                          @Override
                                                          public void onFailure(@NotNull Call call, @NotNull IOException e) {
                                              
                                                          }
                                              
                                                          @Override
                                                          public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
                                                              if (response.isSuccessful()){
                                                                  bytes = response.body().bytes();
                                                              }
                                                          }
                                                      });
                                                      System.out.println(bytes == null);
                                              

                                              打印结果

                                              true
                                              

                                              随后报错。

                                              Orisland Nambers H 3 Replies Last reply Reply Quote 0
                                              • 1
                                              • 2
                                              • 3
                                              • 1 / 3
                                              • First post
                                                Last post
                                              Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact