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

Surface exceptions from Cython to Python as much as possible #16971

Merged
merged 1 commit into from Dec 4, 2018

Conversation

lidizheng
Copy link
Contributor

@lidizheng lidizheng commented Oct 23, 2018

  • If the function is returning an Python object, except * is not needed
  • The integration between nogil and except * is under investigation

Issues #16643

@lidizheng lidizheng added lang/Python release notes: yes Indicates if PR needs to be in release notes labels Oct 23, 2018
@lidizheng lidizheng self-assigned this Oct 23, 2018
@grpc-testing
Copy link

Objective-C binary sizes
*****************STATIC******************
  New size                      Old size
 1,997,294      Total (=)      1,997,294

 No significant differences in binary sizes

***************FRAMEWORKS****************
  New size                      Old size
11,021,762      Total (>)     11,021,758

 No significant differences in binary sizes


Copy link
Member

@nathanielmanistaatgoogle nathanielmanistaatgoogle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything to be done in the way of test coverage?

@lidizheng
Copy link
Contributor Author

@nathanielmanistaatgoogle You are right. I am going to add tests for exceptions that raised by ourselves.

@grpc-testing
Copy link

****************************************************************

libgrpc.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]


****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link

[trickle] No significant performance differences

@grpc-testing
Copy link

Objective-C binary sizes
*****************STATIC******************
  New size                      Old size
 2,020,616      Total (=)      2,020,616

 No significant differences in binary sizes

***************FRAMEWORKS****************
  New size                      Old size
11,180,935      Total (<)     11,180,939

 No significant differences in binary sizes


@grpc-testing
Copy link

Corrupt JSON data (indicates timeout or crash): 
    bm_call_create.BM_IsolatedFilter_ClientChannelFilter_NoOp_.counters.new: 10
    bm_call_create.BM_IsolatedFilter_ClientChannelFilter_NoOp_.counters.old: 10


[microbenchmarks] No significant performance differences

@grpc-testing
Copy link

****************************************************************

libgrpc.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]


****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link

[trickle] No significant performance differences

@grpc-testing
Copy link

Objective-C binary sizes
*****************STATIC******************
  New size                      Old size
 2,020,616      Total (=)      2,020,616

 No significant differences in binary sizes

***************FRAMEWORKS****************
  New size                      Old size
11,180,942      Total (<)     11,180,944

 No significant differences in binary sizes


@grpc-testing
Copy link

Corrupt JSON data (indicates timeout or crash): 
    bm_call_create.BM_IsolatedFilter_ClientChannelFilter_NoOp_.counters.new: 10
    bm_call_create.BM_IsolatedFilter_ClientChannelFilter_NoOp_.counters.old: 10


[microbenchmarks] No significant performance differences

@grpc-testing
Copy link

Objective-C binary sizes
*****************STATIC******************
  New size                      Old size
 2,020,616      Total (=)      2,020,616

 No significant differences in binary sizes

***************FRAMEWORKS****************
  New size                      Old size
11,180,938      Total (<)     11,180,945

 No significant differences in binary sizes


@grpc-testing
Copy link

Objective-C binary sizes
*****************STATIC******************
  New size                      Old size
 2,020,616      Total (=)      2,020,616

 No significant differences in binary sizes

***************FRAMEWORKS****************
  New size                      Old size
11,180,944      Total (>)     11,180,938

 No significant differences in binary sizes


@lidizheng
Copy link
Contributor Author

Hi @nathanielmanistaatgoogle , the best way to test this PR is collecting the cases that people use our public API and their exception got ignored. Currently, I found three of them. The hard part is that if we know the exception will be ignored we already fixed it... So, do you have any insight about this?

@mehrdada
Copy link
Member

mehrdada commented Nov 9, 2018

@lidizheng I feel that is a sensible thing to do. Testing cannot prove absense of all unknown bugs.

@lidizheng
Copy link
Contributor Author

@mehrdada can you elaborate your idea more? Shall we move forward with this PR or wait and collect more corner cases?

Copy link
Member

@mehrdada mehrdada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mehrdada
Copy link
Member

mehrdada commented Nov 9, 2018

@lidizheng The more test cases we have the merrier, but no, I think we should move forward sooner than later, as this is significant progress as is. All our existing tests will also be a safety net as they will see an exception if the Cython layer previously silenced it.

@grpc-testing
Copy link

Objective-C binary sizes
*****************STATIC******************
  New size                      Old size
 2,019,040      Total (=)      2,019,040

 No significant differences in binary sizes

***************FRAMEWORKS****************
  New size                      Old size
11,179,729      Total (<)     11,179,739

 No significant differences in binary sizes


@grpc-testing
Copy link

Objective-C binary sizes
*****************STATIC******************
  New size                      Old size
 2,019,040      Total (=)      2,019,040

 No significant differences in binary sizes

***************FRAMEWORKS****************
  New size                      Old size
11,179,741      Total (>)     11,179,738

 No significant differences in binary sizes


@grpc-testing
Copy link

Objective-C binary sizes
*****************STATIC******************
  New size                      Old size
 2,020,494      Total (=)      2,020,494

 No significant differences in binary sizes

***************FRAMEWORKS****************
  New size                      Old size
11,175,630      Total (>)     11,175,622

 No significant differences in binary sizes


@mehrdada
Copy link
Member

@lidizheng ping

@lidizheng
Copy link
Contributor Author

@mehrdada PTAL, The unit test has been updated.

@lidizheng
Copy link
Contributor Author

@nathanielmanistaatgoogle When you got a chance, can you take a look at this PR again?

@grpc-testing
Copy link

Objective-C binary sizes
*****************STATIC******************
  New size                      Old size
 2,021,324      Total (=)      2,021,324

 No significant differences in binary sizes

***************FRAMEWORKS****************
  New size                      Old size
11,177,657      Total (<)     11,177,663

 No significant differences in binary sizes


Copy link
Member

@mehrdada mehrdada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly LGTM, but perhaps the unit tests are better off folded into the relevant existing test file each instead (metadata test and channel test) instead of a separate file (which would not make sense if it weren't an artifact of project's evolution).

@grpc-testing
Copy link

Objective-C binary sizes
*****************STATIC******************
  New size                      Old size
 2,020,224      Total (=)      2,020,224

 No significant differences in binary sizes

***************FRAMEWORKS****************
  New size                      Old size
11,154,232      Total (>)     11,154,228

 No significant differences in binary sizes


Copy link
Contributor

@ericgribkoff ericgribkoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi Outdated Show resolved Hide resolved
@grpc-testing
Copy link

Objective-C binary sizes
*****************STATIC******************
  New size                      Old size
 2,020,224      Total (=)      2,020,224

 No significant differences in binary sizes

***************FRAMEWORKS****************
  New size                      Old size
11,154,231      Total (>)     11,154,230

 No significant differences in binary sizes


@grpc-testing
Copy link

Objective-C binary sizes
*****************STATIC******************
  New size                      Old size
 2,020,224      Total (=)      2,020,224

 No significant differences in binary sizes

***************FRAMEWORKS****************
  New size                      Old size
11,154,226      Total (>)     11,154,225

 No significant differences in binary sizes


@grpc-testing
Copy link

Objective-C binary sizes
*****************STATIC******************
  New size                      Old size
 2,020,224      Total (=)      2,020,224

 No significant differences in binary sizes

***************FRAMEWORKS****************
  New size                      Old size
11,154,224      Total (>)     11,154,222

 No significant differences in binary sizes


@lidizheng lidizheng merged commit c339ba3 into grpc:master Dec 4, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Mar 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang/Python release notes: yes Indicates if PR needs to be in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants