You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hugegraph.apache.org by "diaohancai (via GitHub)" <gi...@apache.org> on 2023/10/25 07:18:44 UTC
[I] [Bug] RingsDetection test did not meet expectations [incubator-hugegraph-computer]
diaohancai opened a new issue, #275:
URL: https://github.com/apache/incubator-hugegraph-computer/issues/275
### Bug Type (问题类型)
data inconsistency (计算结果不合预期)
### Before submit
- [X] 我已经确认现有的 [Server-Issues](https://github.com/apache/hugegraph-computer/issues) 与 [Computer-Issues](https://github.com/apache/hugegraph-computer/issues) 中没有相同 / 重复问题
### Environment (环境信息)
- Server Version: v1.0.x
- Computer Version: v1.0.x
### Expected & Actual behavior (期望与实际表现)
Run `org.apache.hugegraph.computer.algorithm.path.rings.RingsDetectionTest#testRunAlgorithm`,
Vertex A expected result is:
```
[[A, C, A], [A, D, A], [A, B, C, A], [A, D, C, A], [A, C, E, D, A], [A, B, C, E, D, A]]
```
But got:
```
[[A, D, A], [A, D, A], [A, D, C, A], [A, D, C, A], [A, C, E, D, A], [A, B, C, E, D, A]]
```
I modified some code and it works.
```
@Override
public void compute(ComputationContext context, Vertex vertex,
Iterator<IdList> messages) {
Id id = vertex.id();
boolean halt = true;
while (messages.hasNext()) {
halt = false;
// IdList sequence = messages.next(); // Something is wrong here
IdList sequence = messages.next().copy(); // copy() is good
...
```
Further debug, I found `messages.next()` always return the same address Object(field value may be different)!!!, it's a reference Object.
Semantically, I think `messages.next()` should return a different address Object.
--
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: issues-unsubscribe@hugegraph.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [I] [Bug] RingsDetection test did not meet expectations [incubator-hugegraph-computer]
Posted by "diaohancai (via GitHub)" <gi...@apache.org>.
diaohancai commented on issue #275:
URL: https://github.com/apache/incubator-hugegraph-computer/issues/275#issuecomment-1779114554
Possible solutions:
`org.apache.hugegraph.computer.core.compute.input.MessageInput`
```java
@Override
public boolean hasNext() {
if (this.valueValid) {
return true;
}
if (MessageInput.this.messages.hasNext()) {
KvEntry entry = MessageInput.this.messages.peek();
Pointer key = entry.key();
int status = this.vidPointer.compareTo(key);
if (status == 0) {
MessageInput.this.messages.next();
this.valueValid = true;
try {
BytesInput in = IOFactory.createBytesInput(
entry.value().bytes());
// create a new value
MessageInput.this.value = MessageInput.this.config
.createObject(ComputerOptions.ALGORITHM_MESSAGE_CLASS);
MessageInput.this.value.read(in);
```
`messages.next()` return a different address Object.
--
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: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [I] [Bug] RingsDetection test did not meet expectations [incubator-hugegraph-computer]
Posted by "corgiboygsj (via GitHub)" <gi...@apache.org>.
corgiboygsj commented on issue #275:
URL: https://github.com/apache/incubator-hugegraph-computer/issues/275#issuecomment-1779226682
> Possible solutions: `org.apache.hugegraph.computer.core.compute.input.MessageInput`
>
> ```java
> @Override
> public boolean hasNext() {
> if (this.valueValid) {
> return true;
> }
> if (MessageInput.this.messages.hasNext()) {
> KvEntry entry = MessageInput.this.messages.peek();
> Pointer key = entry.key();
> int status = this.vidPointer.compareTo(key);
> if (status == 0) {
> MessageInput.this.messages.next();
> this.valueValid = true;
> try {
> BytesInput in = IOFactory.createBytesInput(
> entry.value().bytes());
> // create a new value
> MessageInput.this.value = MessageInput.this.config
> .createObject(ComputerOptions.ALGORITHM_MESSAGE_CLASS);
> MessageInput.this.value.read(in);
> ```
>
> `messages.next()` return a different address Object.
always return the same Object is reduce memory pressure and avoid GC
--
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: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [I] [Bug] RingsDetection test did not meet expectations [incubator-hugegraph-computer]
Posted by "javeme (via GitHub)" <gi...@apache.org>.
javeme commented on issue #275:
URL: https://github.com/apache/incubator-hugegraph-computer/issues/275#issuecomment-1783991511
I agree this is a problem, it sacrifices user-friendliness for performance.
We hope that after the memory management module is added, this confusion can be solved.
--
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: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [I] [Bug] RingsDetection test did not meet expectations [incubator-hugegraph-computer]
Posted by "diaohancai (via GitHub)" <gi...@apache.org>.
diaohancai commented on issue #275:
URL: https://github.com/apache/incubator-hugegraph-computer/issues/275#issuecomment-1779336049
> always return the same Object is reduce memory pressure and avoid GC
Yep~ But semantically, `messages.next()` returns a different address object more intuitive.
Otherwise, someone who call this function downstream need to clearly know that the same object is returned here, which is not logically intuitive and easy to make mistakes.
Do we have some more elegant solutions?
--
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: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [I] [Bug] RingsDetection test did not meet expectations [incubator-hugegraph-computer]
Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin closed issue #275: [Bug] RingsDetection test did not meet expectations
URL: https://github.com/apache/incubator-hugegraph-computer/issues/275
--
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: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [I] [Bug] RingsDetection test did not meet expectations [incubator-hugegraph-computer]
Posted by "corgiboygsj (via GitHub)" <gi...@apache.org>.
corgiboygsj commented on issue #275:
URL: https://github.com/apache/incubator-hugegraph-computer/issues/275#issuecomment-1780301889
@javeme please take a look for this question. This does make it confusing for users.
--
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: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org