Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hangs when try to UploadSaveBigFilePart #51

Open
blez opened this issue Dec 18, 2020 · 6 comments
Open

Hangs when try to UploadSaveBigFilePart #51

blez opened this issue Dec 18, 2020 · 6 comments
Assignees
Labels
bug Something isn't working need investigation Further information is requested

Comments

@blez
Copy link

blez commented Dec 18, 2020

When I do

_, err := client.UploadSaveBigFilePart(fi, int32(i), int32(totalParts), part)
if err != nil {
	panic(err)
}

it just hands with message in log

nil &errors.withStack{
  error: &errors.withMessage{
    cause: &errors.withStack{
      error: &errors.withMessage{
        cause: &errors.withStack{
          error: &errors.withMessage{
            cause: &errors.withStack{
              error: &errors.withMessage{
                cause: tl.ErrRegisteredObjectNotFound{
                  Crc:  0x997275b5,
                  Data: []uint8{},
                },
                msg: "decode interface",
              },
              stack: &errors.stack{
                0x93ddd6,
                0x93d05b,
                0x93e7d0,
                0x93ca5d,
                0x95baa5,
                0x95f150,
                0x46bbe1,
              },
            },
            msg: "decode field 'Obj'",
          },
          stack: &errors.stack{
            0x93d16a,
            0x93e7d0,
            0x93ca5d,
            0x95baa5,
            0x95f150,
            0x46bbe1,
          },
        },
        msg: "decode registered object *objects.RpcResult",
      },
      stack: &errors.stack{
        0x93e84b,
        0x93ca5d,
        0x95baa5,
        0x95f150,
        0x46bbe1,
      },
    },
    msg: "decoding predicted object",
  },
  stack: &errors.stack{
    0x93ca9c,
    0x95baa5,
    0x95f150,
    0x46bbe1,
  },

I use https://github.com/xelaj/mtproto/tree/new_decoder_refactoring
Based on

cause: tl.ErrRegisteredObjectNotFound{
  Crc:  0x997275b5,
  Data: []uint8{},
},

I assume I have same problem here as in #50

@blez
Copy link
Author

blez commented Dec 23, 2020

Hello, sorry for pushing you, just interesting if there are any updates for that issue?

@quenbyako quenbyako added the bug Something isn't working label Dec 23, 2020
@quenbyako quenbyako self-assigned this Dec 23, 2020
@quenbyako
Copy link
Member

Hey @blez! Thanks for asking and ping for inactivity!

I researched this issue, Here is whats happen:

So, TL schema has preeeety few types, including only bytestream and a few types of integers and floats (int32, uint32, int64, int128 and int256). Also it support custom crc codes for defining specific objects with specific decoding. See something wrong?

Yyyyeup, no single type for boolean, arrays, nulltype, etc. So, in TL, bool true and false are objects!

What's the problem? bool type cant implement Object interface in any case in go. We try to fix it with adding specific struct InterfacedObject in near future updates (until new year), which contains only interface{} parameter and Unwrap method, which is getting you native object (bool, slice, ar what you want)

P.S. If you want for faster responses, write us in telegram chat.

@quenbyako
Copy link
Member

@blez i'll tried to fix this bug, tests passed out, but in real life result ma be different, so i'll not close this issue yet.

If you have a few time, your feedback will be appreciated

@quenbyako quenbyako added the need investigation Further information is requested label Dec 23, 2020
@blez
Copy link
Author

blez commented Dec 23, 2020

No, does not work

panic: got invalid response type: bool

goroutine 1 [running]:
github.com/xelaj/mtproto/telegram.(*Client).UploadSaveBigFilePart(0xc0001ef340, 0x47c3f6d0649b4e9, 0x7f00000000, 0xc000380000, 0x80000, 0x3f5e19a, 0x0, 0x0, 0x0)
	/home/paval/go/pkg/mod/github.com/xelaj/[email protected]/telegram/methods_gen.go:9078 +0x20d
main.main()
exit status 2

@quenbyako
Copy link
Member

@blez could you please share your code in playground? Just want to understand in which context client panics

@blez
Copy link
Author

blez commented Jan 21, 2021

@quenbyako
Something like this https://play.golang.org/p/zv6WaheNR_Y
But I'm not sure my code is an issue. Your lib can't "parse" bool response

panic: got invalid response type: bool

goroutine 1 [running]:
github.com/xelaj/mtproto/telegram.(*Client).UploadSaveBigFilePart(0xc0001cf380, 0x6ce07ec8745d7a83, 0x7f00000000, 0xc000300000, 0x80000, 0x3f5e19a, 0x0, 0x0, 0x0)
exit status 2

quenbyako added a commit that referenced this issue Jan 22, 2021
* See #51 for understanding, what's happening in this fix: we're trying
to parse boolean, slice and nil types, when we don't know, what does
message contains
* this improvement can be buggy or incorrect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need investigation Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants